mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-11-24 19:45:14 +01:00
Replace GuiUtils and HeadLib to the PanelUtils library.
This commit is contained in:
parent
e4f93615ce
commit
e9f37e8dee
48
pom.xml
48
pom.xml
@ -40,6 +40,7 @@
|
||||
<bentobox.version>1.17.3</bentobox.version>
|
||||
<level.version>2.6.3</level.version>
|
||||
<vault.version>1.7</vault.version>
|
||||
<panelutils.version>1.0.0</panelutils.version>
|
||||
<!-- Revision variable removes warning about dynamic version -->
|
||||
<revision>${build.version}-SNAPSHOT</revision>
|
||||
<!-- This allows to change between versions and snapshots. -->
|
||||
@ -136,7 +137,7 @@
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>plugin-annotations</artifactId>
|
||||
<version>1.2.3-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Vault API -->
|
||||
<dependency>
|
||||
@ -158,11 +159,19 @@
|
||||
<version>${level.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- PanelUtils -->
|
||||
<dependency>
|
||||
<groupId>lv.id.bonne</groupId>
|
||||
<artifactId>panelutils</artifactId>
|
||||
<version>${panelutils.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- Annotations -->
|
||||
<dependency>
|
||||
<groupId>org.jetbrains</groupId>
|
||||
<artifactId>annotations</artifactId>
|
||||
<version>21.0.1</version>
|
||||
<version>22.0.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Mockito (Unit testing) -->
|
||||
<dependency>
|
||||
@ -190,7 +199,6 @@
|
||||
<version>1.5.21</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
@ -236,6 +244,8 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.7.0</version>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<release>${java.version}</release>
|
||||
</configuration>
|
||||
</plugin>
|
||||
@ -350,6 +360,38 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.3.1-SNAPSHOT</version>
|
||||
<configuration>
|
||||
<minimizeJar>true</minimizeJar>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>lv.id.bonne:panelutils:*</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<transformers>
|
||||
<!-- Add a transformer to exclude any other manifest files (possibly from dependencies). -->
|
||||
<transformer implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
|
||||
<resource>MANIFEST.MF</resource>
|
||||
</transformer>
|
||||
<!-- Add a transformer to include your custom manifest file. -->
|
||||
<transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
|
||||
<resource>META-INF/MANIFEST.MF</resource>
|
||||
<file>src/main/resources/META-INF/MANIFEST.MF</file>
|
||||
</transformer>
|
||||
</transformers>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
@ -39,7 +39,7 @@ public class IslandRequirements extends Requirements
|
||||
/**
|
||||
* Method IslandRequirements#getRequiredBlocks returns the requiredBlocks of this object.
|
||||
*
|
||||
* @return the requiredBlocks (type Map<Material, Integer>) of this object.
|
||||
* @return the requiredBlocks (type {@code Map<Material, Integer>}) of this object.
|
||||
*/
|
||||
public Map<Material, Integer> getRequiredBlocks()
|
||||
{
|
||||
@ -83,7 +83,7 @@ public class IslandRequirements extends Requirements
|
||||
/**
|
||||
* Method IslandRequirements#getRequiredEntities returns the requiredEntities of this object.
|
||||
*
|
||||
* @return the requiredEntities (type Map<EntityType, Integer>) of this object.
|
||||
* @return the requiredEntities (type {@code Map<EntityType, Integer>}) of this object.
|
||||
*/
|
||||
public Map<EntityType, Integer> getRequiredEntities()
|
||||
{
|
||||
|
@ -11,6 +11,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import lv.id.bonne.panelutils.PanelUtils;
|
||||
import world.bentobox.bentobox.api.panels.PanelItem;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
|
||||
@ -20,7 +21,6 @@ import world.bentobox.challenges.panel.CommonPanel;
|
||||
import world.bentobox.challenges.panel.ConversationUtils;
|
||||
import world.bentobox.challenges.panel.util.ChallengeTypeSelector;
|
||||
import world.bentobox.challenges.utils.Constants;
|
||||
import world.bentobox.challenges.utils.GuiUtils;
|
||||
import world.bentobox.challenges.utils.Utils;
|
||||
import world.bentobox.challenges.web.WebManager;
|
||||
|
||||
@ -84,7 +84,7 @@ public class AdminPanel extends CommonPanel
|
||||
PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name(
|
||||
this.user.getTranslation(Constants.TITLE + "admin-gui"));
|
||||
|
||||
GuiUtils.fillBorder(panelBuilder);
|
||||
PanelUtils.fillBorder(panelBuilder);
|
||||
|
||||
panelBuilder.item(10, this.createButton(Button.COMPLETE_USER_CHALLENGES));
|
||||
panelBuilder.item(19, this.createButton(Button.RESET_USER_CHALLENGES));
|
||||
|
@ -12,6 +12,7 @@ import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import lv.id.bonne.panelutils.PanelUtils;
|
||||
import world.bentobox.bentobox.api.panels.PanelItem;
|
||||
import world.bentobox.bentobox.api.panels.PanelListener;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
|
||||
@ -28,7 +29,6 @@ import world.bentobox.challenges.panel.CommonPanel;
|
||||
import world.bentobox.challenges.panel.ConversationUtils;
|
||||
import world.bentobox.challenges.panel.util.*;
|
||||
import world.bentobox.challenges.utils.Constants;
|
||||
import world.bentobox.challenges.utils.GuiUtils;
|
||||
import world.bentobox.challenges.utils.Utils;
|
||||
|
||||
|
||||
@ -125,7 +125,7 @@ public class EditChallengePanel extends CommonPanel
|
||||
this.user.getTranslation(Constants.TITLE + "edit-challenge",
|
||||
"[challenge]", this.challenge.getFriendlyName()));
|
||||
|
||||
GuiUtils.fillBorder(panelBuilder);
|
||||
PanelUtils.fillBorder(panelBuilder);
|
||||
|
||||
panelBuilder.item(2, this.createMenuButton(MenuType.PROPERTIES));
|
||||
panelBuilder.item(4, this.createMenuButton(MenuType.REQUIREMENTS));
|
||||
@ -1330,7 +1330,7 @@ public class EditChallengePanel extends CommonPanel
|
||||
|
||||
icon = requirements.getEntity() == null ?
|
||||
new ItemStack(Material.BARRIER) :
|
||||
new ItemStack(GuiUtils.getEntityEgg(requirements.getEntity()));
|
||||
new ItemStack(PanelUtils.getEntityEgg(requirements.getEntity()));
|
||||
clickHandler = (panel, user, clickType, slot) -> {
|
||||
SingleEntitySelector.open(this.user,
|
||||
true,
|
||||
|
@ -11,6 +11,7 @@ import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import lv.id.bonne.panelutils.PanelUtils;
|
||||
import world.bentobox.bentobox.api.panels.PanelItem;
|
||||
import world.bentobox.bentobox.api.panels.PanelListener;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
|
||||
@ -27,7 +28,6 @@ import world.bentobox.challenges.panel.ConversationUtils;
|
||||
import world.bentobox.challenges.panel.util.ItemSelector;
|
||||
import world.bentobox.challenges.panel.util.ChallengeSelector;
|
||||
import world.bentobox.challenges.utils.Constants;
|
||||
import world.bentobox.challenges.utils.GuiUtils;
|
||||
import world.bentobox.challenges.utils.Utils;
|
||||
|
||||
|
||||
@ -131,7 +131,7 @@ public class EditLevelPanel extends CommonPagedPanel<Challenge>
|
||||
this.user.getTranslation(Constants.TITLE + "edit-level",
|
||||
"[level]", this.challengeLevel.getFriendlyName()));
|
||||
|
||||
GuiUtils.fillBorder(panelBuilder);
|
||||
PanelUtils.fillBorder(panelBuilder);
|
||||
|
||||
panelBuilder.item(2, this.createMenuButton(MenuType.PROPERTIES));
|
||||
panelBuilder.item(4, this.createMenuButton(MenuType.REWARDS));
|
||||
|
@ -11,6 +11,7 @@ import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import lv.id.bonne.panelutils.PanelUtils;
|
||||
import world.bentobox.bentobox.api.panels.PanelItem;
|
||||
import world.bentobox.bentobox.api.panels.PanelListener;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
|
||||
@ -23,7 +24,6 @@ import world.bentobox.challenges.config.SettingsUtils.VisibilityMode;
|
||||
import world.bentobox.challenges.panel.CommonPanel;
|
||||
import world.bentobox.challenges.panel.ConversationUtils;
|
||||
import world.bentobox.challenges.utils.Constants;
|
||||
import world.bentobox.challenges.utils.GuiUtils;
|
||||
import world.bentobox.challenges.utils.Utils;
|
||||
|
||||
|
||||
@ -105,7 +105,7 @@ public class EditSettingsPanel extends CommonPanel
|
||||
PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name(
|
||||
this.user.getTranslation(Constants.TITLE + "settings"));
|
||||
|
||||
GuiUtils.fillBorder(panelBuilder);
|
||||
PanelUtils.fillBorder(panelBuilder);
|
||||
|
||||
panelBuilder.item(10, this.getSettingsButton(Button.SHOW_TITLE));
|
||||
|
||||
|
@ -15,6 +15,7 @@ import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import lv.id.bonne.panelutils.PanelUtils;
|
||||
import world.bentobox.bentobox.api.panels.PanelItem;
|
||||
import world.bentobox.bentobox.api.panels.PanelListener;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
|
||||
@ -24,7 +25,6 @@ import world.bentobox.challenges.panel.CommonPagedPanel;
|
||||
import world.bentobox.challenges.panel.CommonPanel;
|
||||
import world.bentobox.challenges.panel.ConversationUtils;
|
||||
import world.bentobox.challenges.utils.Constants;
|
||||
import world.bentobox.challenges.utils.GuiUtils;
|
||||
import world.bentobox.challenges.utils.Utils;
|
||||
import world.bentobox.challenges.web.object.LibraryEntry;
|
||||
|
||||
@ -182,7 +182,7 @@ public class LibraryPanel extends CommonPagedPanel<LibraryEntry>
|
||||
PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name(
|
||||
this.user.getTranslation(Constants.TITLE + "library"));
|
||||
|
||||
GuiUtils.fillBorder(panelBuilder);
|
||||
PanelUtils.fillBorder(panelBuilder);
|
||||
|
||||
this.populateElements(panelBuilder, this.filterElements);
|
||||
|
||||
|
@ -8,6 +8,7 @@ import java.util.stream.Collectors;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
|
||||
import lv.id.bonne.panelutils.PanelUtils;
|
||||
import world.bentobox.bentobox.api.panels.PanelItem;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
|
||||
@ -19,7 +20,6 @@ import world.bentobox.challenges.panel.CommonPagedPanel;
|
||||
import world.bentobox.challenges.panel.CommonPanel;
|
||||
import world.bentobox.challenges.panel.ConversationUtils;
|
||||
import world.bentobox.challenges.utils.Constants;
|
||||
import world.bentobox.challenges.utils.GuiUtils;
|
||||
import world.bentobox.challenges.utils.Utils;
|
||||
|
||||
|
||||
@ -119,11 +119,11 @@ public class ListChallengesPanel extends CommonPagedPanel<Challenge>
|
||||
|
||||
if (this.currentMode.equals(Mode.DELETE))
|
||||
{
|
||||
GuiUtils.fillBorder(panelBuilder, Material.RED_STAINED_GLASS_PANE);
|
||||
PanelUtils.fillBorder(panelBuilder, Material.RED_STAINED_GLASS_PANE);
|
||||
}
|
||||
else
|
||||
{
|
||||
GuiUtils.fillBorder(panelBuilder);
|
||||
PanelUtils.fillBorder(panelBuilder);
|
||||
}
|
||||
|
||||
List<Challenge> challengeList = this.addon.getChallengesManager().getAllChallenges(this.world).
|
||||
|
@ -8,19 +8,18 @@ import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import lv.id.bonne.panelutils.PanelUtils;
|
||||
import world.bentobox.bentobox.api.panels.PanelItem;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
import world.bentobox.bentobox.util.Util;
|
||||
import world.bentobox.challenges.ChallengesAddon;
|
||||
import world.bentobox.challenges.database.object.Challenge;
|
||||
import world.bentobox.challenges.database.object.ChallengeLevel;
|
||||
import world.bentobox.challenges.panel.CommonPagedPanel;
|
||||
import world.bentobox.challenges.panel.CommonPanel;
|
||||
import world.bentobox.challenges.panel.ConversationUtils;
|
||||
import world.bentobox.challenges.utils.Constants;
|
||||
import world.bentobox.challenges.utils.GuiUtils;
|
||||
import world.bentobox.challenges.utils.Utils;
|
||||
|
||||
|
||||
@ -120,11 +119,11 @@ public class ListLevelsPanel extends CommonPagedPanel<ChallengeLevel>
|
||||
|
||||
if (this.currentMode.equals(Mode.DELETE))
|
||||
{
|
||||
GuiUtils.fillBorder(panelBuilder, Material.RED_STAINED_GLASS_PANE);
|
||||
PanelUtils.fillBorder(panelBuilder, Material.RED_STAINED_GLASS_PANE);
|
||||
}
|
||||
else
|
||||
{
|
||||
GuiUtils.fillBorder(panelBuilder);
|
||||
PanelUtils.fillBorder(panelBuilder);
|
||||
}
|
||||
|
||||
List<ChallengeLevel> levelList = this.addon.getChallengesManager().getLevels(this.world).
|
||||
|
@ -12,6 +12,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import lv.id.bonne.panelutils.PanelUtils;
|
||||
import world.bentobox.bentobox.api.panels.PanelItem;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
|
||||
@ -24,7 +25,6 @@ import world.bentobox.challenges.panel.CommonPagedPanel;
|
||||
import world.bentobox.challenges.panel.CommonPanel;
|
||||
import world.bentobox.challenges.panel.util.ChallengeSelector;
|
||||
import world.bentobox.challenges.utils.Constants;
|
||||
import world.bentobox.challenges.utils.GuiUtils;
|
||||
import world.bentobox.challenges.utils.Utils;
|
||||
|
||||
|
||||
@ -135,7 +135,7 @@ public class ListUsersPanel extends CommonPagedPanel<Player>
|
||||
PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name(
|
||||
this.user.getTranslation(Constants.TITLE + "choose-player"));
|
||||
|
||||
GuiUtils.fillBorder(panelBuilder);
|
||||
PanelUtils.fillBorder(panelBuilder);
|
||||
|
||||
this.populateElements(panelBuilder, this.filterElements);
|
||||
|
||||
|
@ -13,6 +13,7 @@ import java.util.stream.Collectors;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import lv.id.bonne.panelutils.PanelUtils;
|
||||
import world.bentobox.bentobox.api.panels.PanelItem;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
|
||||
@ -21,7 +22,6 @@ import world.bentobox.challenges.panel.CommonPanel;
|
||||
import world.bentobox.challenges.panel.ConversationUtils;
|
||||
import world.bentobox.challenges.panel.util.MultiBlockSelector;
|
||||
import world.bentobox.challenges.utils.Constants;
|
||||
import world.bentobox.challenges.utils.GuiUtils;
|
||||
import world.bentobox.challenges.utils.Utils;
|
||||
|
||||
|
||||
@ -93,7 +93,7 @@ public class ManageBlocksPanel extends CommonPagedPanel<Material>
|
||||
name(this.user.getTranslation(Constants.TITLE + "manage-blocks"));
|
||||
|
||||
// Create nice border.
|
||||
GuiUtils.fillBorder(panelBuilder);
|
||||
PanelUtils.fillBorder(panelBuilder);
|
||||
|
||||
panelBuilder.item(3, this.createButton(Button.ADD_BLOCK));
|
||||
panelBuilder.item(5, this.createButton(Button.REMOVE_BLOCK));
|
||||
@ -233,7 +233,7 @@ public class ManageBlocksPanel extends CommonPagedPanel<Material>
|
||||
return new PanelItemBuilder().
|
||||
name(this.user.getTranslation(reference + "name", "[material]",
|
||||
Utils.prettifyObject(material, this.user))).
|
||||
icon(GuiUtils.getMaterialItem(material, this.materialMap.get(material))).
|
||||
icon(PanelUtils.getMaterialItem(material, this.materialMap.get(material))).
|
||||
description(description).
|
||||
clickHandler((panel, user1, clickType, slot) -> {
|
||||
// On right click change which entities are selected for deletion.
|
||||
|
@ -14,6 +14,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import lv.id.bonne.panelutils.PanelUtils;
|
||||
import world.bentobox.bentobox.api.panels.PanelItem;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
|
||||
@ -22,7 +23,6 @@ import world.bentobox.challenges.panel.CommonPanel;
|
||||
import world.bentobox.challenges.panel.ConversationUtils;
|
||||
import world.bentobox.challenges.panel.util.MultiEntitySelector;
|
||||
import world.bentobox.challenges.utils.Constants;
|
||||
import world.bentobox.challenges.utils.GuiUtils;
|
||||
import world.bentobox.challenges.utils.Utils;
|
||||
|
||||
|
||||
@ -91,7 +91,7 @@ public class ManageEntitiesPanel extends CommonPagedPanel<EntityType>
|
||||
name(this.user.getTranslation(Constants.TITLE + "manage-entities"));
|
||||
|
||||
// create border
|
||||
GuiUtils.fillBorder(panelBuilder);
|
||||
PanelUtils.fillBorder(panelBuilder);
|
||||
|
||||
panelBuilder.item(3, this.createButton(Button.ADD_ENTITY));
|
||||
panelBuilder.item(5, this.createButton(Button.REMOVE_ENTITY));
|
||||
@ -244,8 +244,8 @@ public class ManageEntitiesPanel extends CommonPagedPanel<EntityType>
|
||||
name(this.user.getTranslation(reference + "name", "[entity]",
|
||||
Utils.prettifyObject(entity, this.user))).
|
||||
icon(this.asEggs ?
|
||||
GuiUtils.getEntityEgg(entity, this.requiredEntities.get(entity)) :
|
||||
GuiUtils.getEntityHead(entity, this.requiredEntities.get(entity))).
|
||||
PanelUtils.getEntityEgg(entity, this.requiredEntities.get(entity)) :
|
||||
PanelUtils.getEntityHead(entity, this.requiredEntities.get(entity))).
|
||||
description(description).
|
||||
clickHandler((panel, user1, clickType, slot) -> {
|
||||
// On right click change which entities are selected for deletion.
|
||||
|
@ -12,6 +12,7 @@ import java.util.stream.Collectors;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import lv.id.bonne.panelutils.PanelUtils;
|
||||
import world.bentobox.bentobox.api.panels.PanelItem;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
|
||||
@ -19,7 +20,6 @@ import world.bentobox.bentobox.api.user.User;
|
||||
import world.bentobox.bentobox.util.Util;
|
||||
import world.bentobox.challenges.database.object.Challenge;
|
||||
import world.bentobox.challenges.utils.Constants;
|
||||
import world.bentobox.challenges.utils.GuiUtils;
|
||||
|
||||
|
||||
/**
|
||||
@ -61,7 +61,7 @@ public class ChallengeSelector extends PagedSelector<Challenge>
|
||||
PanelBuilder panelBuilder = new PanelBuilder().user(this.user);
|
||||
panelBuilder.name(this.user.getTranslation(Constants.TITLE + "challenge-selector"));
|
||||
|
||||
GuiUtils.fillBorder(panelBuilder, this.border);
|
||||
PanelUtils.fillBorder(panelBuilder, this.border);
|
||||
|
||||
this.populateElements(panelBuilder, this.filterElements);
|
||||
|
||||
|
@ -8,12 +8,12 @@ import java.util.stream.Collectors;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import lv.id.bonne.panelutils.PanelUtils;
|
||||
import world.bentobox.bentobox.api.panels.PanelItem;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
import world.bentobox.challenges.utils.Constants;
|
||||
import world.bentobox.challenges.utils.GuiUtils;
|
||||
import world.bentobox.challenges.utils.Utils;
|
||||
|
||||
|
||||
@ -104,7 +104,7 @@ public class MultiBlockSelector extends PagedSelector<Material>
|
||||
PanelBuilder panelBuilder = new PanelBuilder().user(this.user);
|
||||
panelBuilder.name(this.user.getTranslation(Constants.TITLE + "block-selector"));
|
||||
|
||||
GuiUtils.fillBorder(panelBuilder, Material.BLUE_STAINED_GLASS_PANE);
|
||||
PanelUtils.fillBorder(panelBuilder, Material.BLUE_STAINED_GLASS_PANE);
|
||||
|
||||
this.populateElements(panelBuilder, this.filterElements);
|
||||
|
||||
@ -233,7 +233,7 @@ public class MultiBlockSelector extends PagedSelector<Material>
|
||||
return new PanelItemBuilder().
|
||||
name(this.user.getTranslation(reference + "name", "[material]",
|
||||
Utils.prettifyObject(material, this.user))).
|
||||
icon(GuiUtils.getMaterialItem(material)).
|
||||
icon(PanelUtils.getMaterialItem(material)).
|
||||
description(description).
|
||||
clickHandler((panel, user1, clickType, slot) -> {
|
||||
// On right click change which entities are selected for deletion.
|
||||
|
@ -8,12 +8,12 @@ import java.util.*;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import lv.id.bonne.panelutils.PanelUtils;
|
||||
import world.bentobox.bentobox.api.panels.PanelItem;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
import world.bentobox.challenges.utils.Constants;
|
||||
import world.bentobox.challenges.utils.GuiUtils;
|
||||
import world.bentobox.challenges.utils.Utils;
|
||||
|
||||
|
||||
@ -88,7 +88,7 @@ public class MultiEntitySelector extends PagedSelector<EntityType>
|
||||
PanelBuilder panelBuilder = new PanelBuilder().user(this.user);
|
||||
panelBuilder.name(this.user.getTranslation(Constants.TITLE + "entity-selector"));
|
||||
|
||||
GuiUtils.fillBorder(panelBuilder, Material.BLUE_STAINED_GLASS_PANE);
|
||||
PanelUtils.fillBorder(panelBuilder, Material.BLUE_STAINED_GLASS_PANE);
|
||||
|
||||
this.populateElements(panelBuilder, this.filterElements);
|
||||
|
||||
@ -217,7 +217,7 @@ public class MultiEntitySelector extends PagedSelector<EntityType>
|
||||
return new PanelItemBuilder().
|
||||
name(this.user.getTranslation(reference + "name", "[entity]",
|
||||
Utils.prettifyObject(entity, this.user))).
|
||||
icon(this.asEgg ? GuiUtils.getEntityEgg(entity) : GuiUtils.getEntityHead(entity)).
|
||||
icon(this.asEgg ? PanelUtils.getEntityEgg(entity) : PanelUtils.getEntityHead(entity)).
|
||||
description(description).
|
||||
clickHandler((panel, user1, clickType, slot) -> {
|
||||
// On right click change which entities are selected for deletion.
|
||||
|
@ -7,12 +7,12 @@ import java.util.*;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import lv.id.bonne.panelutils.PanelUtils;
|
||||
import world.bentobox.bentobox.api.panels.PanelItem;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
import world.bentobox.challenges.utils.Constants;
|
||||
import world.bentobox.challenges.utils.GuiUtils;
|
||||
import world.bentobox.challenges.utils.Utils;
|
||||
|
||||
|
||||
@ -114,7 +114,7 @@ public class SingleBlockSelector extends PagedSelector<Material>
|
||||
PanelBuilder panelBuilder = new PanelBuilder().user(this.user);
|
||||
panelBuilder.name(this.user.getTranslation(Constants.TITLE + "block-selector"));
|
||||
|
||||
GuiUtils.fillBorder(panelBuilder, Material.BLUE_STAINED_GLASS_PANE);
|
||||
PanelUtils.fillBorder(panelBuilder, Material.BLUE_STAINED_GLASS_PANE);
|
||||
|
||||
this.populateElements(panelBuilder, this.filterElements);
|
||||
|
||||
@ -197,7 +197,7 @@ public class SingleBlockSelector extends PagedSelector<Material>
|
||||
return new PanelItemBuilder().
|
||||
name(this.user.getTranslation(reference + "name", "[material]",
|
||||
Utils.prettifyObject(material, this.user))).
|
||||
icon(GuiUtils.getMaterialItem(material)).
|
||||
icon(PanelUtils.getMaterialItem(material)).
|
||||
description(description).
|
||||
clickHandler((panel, user1, clickType, slot) -> {
|
||||
this.consumer.accept(true, material);
|
||||
|
@ -9,12 +9,12 @@ import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import lv.id.bonne.panelutils.PanelUtils;
|
||||
import world.bentobox.bentobox.api.panels.PanelItem;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
import world.bentobox.challenges.utils.Constants;
|
||||
import world.bentobox.challenges.utils.GuiUtils;
|
||||
import world.bentobox.challenges.utils.Utils;
|
||||
|
||||
|
||||
@ -107,7 +107,7 @@ public class SingleEntitySelector extends PagedSelector<EntityType>
|
||||
PanelBuilder panelBuilder = new PanelBuilder().user(this.user);
|
||||
panelBuilder.name(this.user.getTranslation(Constants.TITLE + "entity-selector"));
|
||||
|
||||
GuiUtils.fillBorder(panelBuilder, Material.BLUE_STAINED_GLASS_PANE);
|
||||
PanelUtils.fillBorder(panelBuilder, Material.BLUE_STAINED_GLASS_PANE);
|
||||
|
||||
this.populateElements(panelBuilder, this.filterElements);
|
||||
|
||||
@ -159,7 +159,7 @@ public class SingleEntitySelector extends PagedSelector<EntityType>
|
||||
return new PanelItemBuilder().
|
||||
name(this.user.getTranslation(reference + "name", "[entity]",
|
||||
Utils.prettifyObject(entity, this.user))).
|
||||
icon(this.asEggs ? GuiUtils.getEntityEgg(entity) : GuiUtils.getEntityHead(entity)).
|
||||
icon(this.asEggs ? PanelUtils.getEntityEgg(entity) : PanelUtils.getEntityHead(entity)).
|
||||
description(description).
|
||||
clickHandler((panel, user1, clickType, slot) -> {
|
||||
this.consumer.accept(true, entity);
|
||||
|
@ -3,19 +3,17 @@ package world.bentobox.challenges.panel.util;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Statistic;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import java.util.*;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import lv.id.bonne.panelutils.PanelUtils;
|
||||
import world.bentobox.bentobox.api.panels.PanelItem;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
import world.bentobox.challenges.utils.Constants;
|
||||
import world.bentobox.challenges.utils.GuiUtils;
|
||||
import world.bentobox.challenges.utils.Utils;
|
||||
|
||||
|
||||
@ -70,7 +68,7 @@ public class StatisticSelector extends PagedSelector<Statistic>
|
||||
PanelBuilder panelBuilder = new PanelBuilder().user(this.user);
|
||||
panelBuilder.name(this.user.getTranslation(Constants.TITLE + "statistic-selector"));
|
||||
|
||||
GuiUtils.fillBorder(panelBuilder, Material.BLUE_STAINED_GLASS_PANE);
|
||||
PanelUtils.fillBorder(panelBuilder, Material.BLUE_STAINED_GLASS_PANE);
|
||||
|
||||
this.populateElements(panelBuilder, this.filterElements);
|
||||
|
||||
|
@ -1,414 +0,0 @@
|
||||
package world.bentobox.challenges.utils;
|
||||
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import world.bentobox.bentobox.api.panels.PanelItem;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
|
||||
|
||||
|
||||
/**
|
||||
* This class contains static methods that is used through multiple GUIs.
|
||||
*/
|
||||
public class GuiUtils
|
||||
{
|
||||
// ---------------------------------------------------------------------
|
||||
// Section: Border around GUIs
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* This method creates border of black panes around given panel with 5 rows.
|
||||
* @param panelBuilder PanelBuilder which must be filled with border blocks.
|
||||
*/
|
||||
public static void fillBorder(PanelBuilder panelBuilder)
|
||||
{
|
||||
GuiUtils.fillBorder(panelBuilder, 5, Material.BLACK_STAINED_GLASS_PANE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method sets black stained glass pane around Panel with given row count.
|
||||
* @param panelBuilder object that builds Panel.
|
||||
* @param rowCount in Panel.
|
||||
*/
|
||||
public static void fillBorder(PanelBuilder panelBuilder, int rowCount)
|
||||
{
|
||||
GuiUtils.fillBorder(panelBuilder, rowCount, Material.BLACK_STAINED_GLASS_PANE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method sets blocks with given Material around Panel with 5 rows.
|
||||
* @param panelBuilder object that builds Panel.
|
||||
* @param material that will be around Panel.
|
||||
*/
|
||||
public static void fillBorder(PanelBuilder panelBuilder, Material material)
|
||||
{
|
||||
GuiUtils.fillBorder(panelBuilder, 5, material);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method sets blocks with given Material around Panel with given row count.
|
||||
* @param panelBuilder object that builds Panel.
|
||||
* @param rowCount in Panel.
|
||||
* @param material that will be around Panel.
|
||||
*/
|
||||
public static void fillBorder(PanelBuilder panelBuilder, int rowCount, Material material)
|
||||
{
|
||||
// Only for useful filling.
|
||||
if (rowCount < 3)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9 * rowCount; i++)
|
||||
{
|
||||
// First (i < 9) and last (i > 35) rows must be filled
|
||||
// First column (i % 9 == 0) and last column (i % 9 == 8) also must be filled.
|
||||
|
||||
if (i < 9 || i > 9 * (rowCount - 1) || i % 9 == 0 || i % 9 == 8)
|
||||
{
|
||||
panelBuilder.item(i, BorderBlock.getPanelBorder(material));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Section: ItemStack transformations
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* This method transforms entity into egg or block that corresponds given entity.
|
||||
* If entity egg is not found, then it is replaced by block that represents entity or
|
||||
* barrier block.
|
||||
* @param entity Entity which egg must be returned.
|
||||
* @return ItemStack that may be egg for given entity.
|
||||
*/
|
||||
public static ItemStack getEntityEgg(EntityType entity)
|
||||
{
|
||||
return GuiUtils.getEntityEgg(entity, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method transforms entity into egg or block that corresponds given entity.
|
||||
* If entity egg is not found, then it is replaced by block that represents entity or
|
||||
* barrier block.
|
||||
* @param entity Entity which egg must be returned.
|
||||
* @param amount Amount of ItemStack elements.
|
||||
* @return ItemStack that may be egg for given entity.
|
||||
*/
|
||||
public static ItemStack getEntityEgg(EntityType entity, int amount)
|
||||
{
|
||||
ItemStack itemStack;
|
||||
|
||||
switch (entity)
|
||||
{
|
||||
case ENDER_DRAGON:
|
||||
itemStack = new ItemStack(Material.DRAGON_EGG);
|
||||
break;
|
||||
case WITHER:
|
||||
itemStack = new ItemStack(Material.SOUL_SAND);
|
||||
break;
|
||||
case PLAYER:
|
||||
itemStack = new ItemStack(Material.PLAYER_HEAD);
|
||||
break;
|
||||
case MUSHROOM_COW:
|
||||
itemStack = new ItemStack(Material.MOOSHROOM_SPAWN_EGG);
|
||||
break;
|
||||
case SNOWMAN:
|
||||
itemStack = new ItemStack(Material.CARVED_PUMPKIN);
|
||||
break;
|
||||
case IRON_GOLEM:
|
||||
itemStack = new ItemStack(Material.IRON_BLOCK);
|
||||
break;
|
||||
case ARMOR_STAND:
|
||||
itemStack = new ItemStack(Material.ARMOR_STAND);
|
||||
break;
|
||||
default:
|
||||
Material material = Material.getMaterial(entity.name() + "_SPAWN_EGG");
|
||||
|
||||
if (material == null)
|
||||
{
|
||||
itemStack = new ItemStack(Material.BARRIER);
|
||||
}
|
||||
else
|
||||
{
|
||||
itemStack = new ItemStack(material);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (entity.name().equals("PIG_ZOMBIE"))
|
||||
{
|
||||
// If pig zombie exist, then pigman spawn egg exists too.
|
||||
itemStack = new ItemStack(Material.getMaterial("ZOMBIE_PIGMAN_SPAWN_EGG"));
|
||||
}
|
||||
|
||||
itemStack.setAmount(amount);
|
||||
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method transforms entity into player head with skin that corresponds given
|
||||
* entity. If entity head is not found, then it is replaced by barrier block.
|
||||
* @param entity Entity which head must be returned.
|
||||
* @return ItemStack that may be head for given entity.
|
||||
*/
|
||||
public static ItemStack getEntityHead(EntityType entity)
|
||||
{
|
||||
return GuiUtils.getEntityHead(entity, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method transforms entity into player head with skin that corresponds given
|
||||
* entity. If entity head is not found, then it is replaced by barrier block.
|
||||
* @param entity Entity which head must be returned.
|
||||
* @param amount Amount of ItemStack elements.
|
||||
* @return ItemStack that may be head for given entity.
|
||||
*/
|
||||
public static ItemStack getEntityHead(EntityType entity, int amount)
|
||||
{
|
||||
ItemStack itemStack;
|
||||
|
||||
switch (entity)
|
||||
{
|
||||
case PLAYER:
|
||||
itemStack = new ItemStack(Material.PLAYER_HEAD);
|
||||
break;
|
||||
case WITHER_SKELETON:
|
||||
itemStack = new ItemStack(Material.WITHER_SKELETON_SKULL);
|
||||
break;
|
||||
case ARMOR_STAND:
|
||||
itemStack = new ItemStack(Material.ARMOR_STAND);
|
||||
break;
|
||||
case SKELETON:
|
||||
itemStack = new ItemStack(Material.SKELETON_SKULL);
|
||||
break;
|
||||
case GIANT:
|
||||
case ZOMBIE:
|
||||
itemStack = new ItemStack(Material.ZOMBIE_HEAD);
|
||||
break;
|
||||
case CREEPER:
|
||||
itemStack = new ItemStack(Material.CREEPER_HEAD);
|
||||
break;
|
||||
case ENDER_DRAGON:
|
||||
itemStack = new ItemStack(Material.DRAGON_HEAD);
|
||||
break;
|
||||
default:
|
||||
HeadLib head = HeadLib.getHead(entity.name());
|
||||
|
||||
if (head == null)
|
||||
{
|
||||
itemStack = new ItemStack(Material.BARRIER);
|
||||
}
|
||||
else
|
||||
{
|
||||
itemStack = head.toItemStack();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
itemStack.setAmount(amount);
|
||||
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method transforms material into item stack that can be displayed in users
|
||||
* inventory.
|
||||
* @param material Material which item stack must be returned.
|
||||
* @return ItemStack that represents given material.
|
||||
*/
|
||||
public static ItemStack getMaterialItem(Material material)
|
||||
{
|
||||
return GuiUtils.getMaterialItem(material, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method transforms material into item stack that can be displayed in users
|
||||
* inventory.
|
||||
* @param material Material which item stack must be returned.
|
||||
* @param amount Amount of ItemStack elements.
|
||||
* @return ItemStack that represents given material.
|
||||
*/
|
||||
public static ItemStack getMaterialItem(Material material, int amount)
|
||||
{
|
||||
ItemStack itemStack;
|
||||
|
||||
// Process items that cannot be item-stacks.
|
||||
if (material.name().contains("WALL_"))
|
||||
{
|
||||
// Materials that is attached to wall cannot be showed in GUI. But they should be in list.
|
||||
|
||||
Material newMaterial = Material.getMaterial(material.name().replace("WALL_", ""));
|
||||
itemStack = new ItemStack(Objects.requireNonNullElse(newMaterial, material));
|
||||
}
|
||||
else if (material.equals(Material.POTTED_AZALEA_BUSH))
|
||||
{
|
||||
return new ItemStack(Material.AZALEA);
|
||||
}
|
||||
else if (material.equals(Material.POTTED_FLOWERING_AZALEA_BUSH))
|
||||
{
|
||||
return new ItemStack(Material.FLOWERING_AZALEA);
|
||||
}
|
||||
else if (material.name().startsWith("POTTED_"))
|
||||
{
|
||||
// Materials Potted elements cannot be in inventory.
|
||||
Material newMaterial = Material.getMaterial(material.name().replace("POTTED_", ""));
|
||||
itemStack = new ItemStack(Objects.requireNonNullElse(newMaterial, material));
|
||||
}
|
||||
else if (material.name().endsWith("CAULDRON"))
|
||||
{
|
||||
itemStack = new ItemStack(Material.CAULDRON);
|
||||
}
|
||||
else if (material.equals(Material.MELON_STEM) || material.equals(Material.ATTACHED_MELON_STEM))
|
||||
{
|
||||
itemStack = new ItemStack(Material.MELON_SEEDS);
|
||||
}
|
||||
else if (material.equals(Material.PUMPKIN_STEM) || material.equals(Material.ATTACHED_PUMPKIN_STEM))
|
||||
{
|
||||
itemStack = new ItemStack(Material.PUMPKIN_SEEDS);
|
||||
}
|
||||
else if (material.equals(Material.TALL_SEAGRASS))
|
||||
{
|
||||
itemStack = new ItemStack(Material.SEAGRASS);
|
||||
}
|
||||
else if (material.equals(Material.CARROTS))
|
||||
{
|
||||
itemStack = new ItemStack(Material.CARROT);
|
||||
}
|
||||
else if (material.equals(Material.BEETROOTS))
|
||||
{
|
||||
itemStack = new ItemStack(Material.BEETROOT);
|
||||
}
|
||||
else if (material.equals(Material.POTATOES))
|
||||
{
|
||||
itemStack = new ItemStack(Material.POTATO);
|
||||
}
|
||||
else if (material.equals(Material.COCOA))
|
||||
{
|
||||
itemStack = new ItemStack(Material.COCOA_BEANS);
|
||||
}
|
||||
else if (material.equals(Material.CAVE_VINES) || material.equals(Material.CAVE_VINES_PLANT))
|
||||
{
|
||||
// Process cave vines as they are glow berries
|
||||
itemStack = new ItemStack(Material.GLOW_BERRIES);
|
||||
}
|
||||
else if (material.name().endsWith("_PLANT"))
|
||||
{
|
||||
// Plants cannot be displayed in GUI's.
|
||||
Material newMaterial = Material.getMaterial(material.name().replace("_PLANT", ""));
|
||||
itemStack = new ItemStack(Objects.requireNonNullElse(newMaterial, material));
|
||||
}
|
||||
else if (material.equals(Material.REDSTONE_WIRE))
|
||||
{
|
||||
itemStack = new ItemStack(Material.REDSTONE);
|
||||
}
|
||||
else if (material.equals(Material.TRIPWIRE))
|
||||
{
|
||||
itemStack = new ItemStack(Material.STRING);
|
||||
}
|
||||
else if (material.equals(Material.FROSTED_ICE))
|
||||
{
|
||||
itemStack = new ItemStack(Material.ICE);
|
||||
}
|
||||
else if (material.equals(Material.END_PORTAL) || material.equals(Material.END_GATEWAY) || material.equals(Material.NETHER_PORTAL))
|
||||
{
|
||||
itemStack = new ItemStack(Material.PAPER);
|
||||
}
|
||||
else if (material.equals(Material.BUBBLE_COLUMN) || material.equals(Material.WATER))
|
||||
{
|
||||
itemStack = new ItemStack(Material.WATER_BUCKET);
|
||||
}
|
||||
else if (material.equals(Material.LAVA))
|
||||
{
|
||||
itemStack = new ItemStack(Material.LAVA_BUCKET);
|
||||
}
|
||||
else if (material.equals(Material.FIRE))
|
||||
{
|
||||
itemStack = new ItemStack(Material.FIRE_CHARGE);
|
||||
}
|
||||
else if (material.equals(Material.AIR) || material.equals(Material.CAVE_AIR) || material.equals(Material.VOID_AIR))
|
||||
{
|
||||
itemStack = new ItemStack(Material.GLASS_BOTTLE);
|
||||
}
|
||||
else if (material.equals(Material.PISTON_HEAD) || material.equals(Material.MOVING_PISTON))
|
||||
{
|
||||
itemStack = new ItemStack(Material.PISTON);
|
||||
}
|
||||
else if (material.equals(Material.BAMBOO_SAPLING))
|
||||
{
|
||||
itemStack = new ItemStack(Material.BAMBOO);
|
||||
}
|
||||
else if (material.equals(Material.SWEET_BERRY_BUSH))
|
||||
{
|
||||
itemStack = new ItemStack(Material.SWEET_BERRIES);
|
||||
}
|
||||
else if (material.name().contains("CANDLE_CAKE"))
|
||||
{
|
||||
itemStack = new ItemStack(Material.CAKE);
|
||||
}
|
||||
else if (material.equals(Material.POWDER_SNOW))
|
||||
{
|
||||
itemStack = new ItemStack(Material.POWDER_SNOW_BUCKET);
|
||||
}
|
||||
else if (material.equals(Material.BIG_DRIPLEAF_STEM))
|
||||
{
|
||||
itemStack = new ItemStack(Material.BIG_DRIPLEAF);
|
||||
}
|
||||
else
|
||||
{
|
||||
itemStack = new ItemStack(material);
|
||||
}
|
||||
|
||||
itemStack.setAmount(amount);
|
||||
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This BorderBlock is simple PanelItem but without item meta data.
|
||||
*/
|
||||
private static class BorderBlock extends PanelItem
|
||||
{
|
||||
private BorderBlock(ItemStack icon)
|
||||
{
|
||||
super(new PanelItemBuilder().
|
||||
icon(icon.clone()).
|
||||
name(" ").
|
||||
description(Collections.emptyList()).
|
||||
glow(false).
|
||||
clickHandler(null));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method retunrs BorderBlock with requested item stack.
|
||||
* @param material of which broder must be created.
|
||||
* @return PanelItem that acts like border.
|
||||
*/
|
||||
private static BorderBlock getPanelBorder(Material material)
|
||||
{
|
||||
ItemStack itemStack = new ItemStack(material);
|
||||
itemStack.getItemMeta().setDisplayName("&r&8");
|
||||
|
||||
return new BorderBlock(itemStack);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,289 +0,0 @@
|
||||
/*
|
||||
* Written in 2018 by Daniel Saukel
|
||||
*
|
||||
* To the extent possible under law, the author(s) have dedicated all
|
||||
* copyright and related and neighboring rights to this software
|
||||
* to the public domain worldwide.
|
||||
*
|
||||
* This software is distributed without any warranty.
|
||||
*
|
||||
* You should have received a copy of the CC0 Public Domain Dedication
|
||||
* along with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||
*
|
||||
* @url https://github.com/DRE2N/HeadLib
|
||||
*/
|
||||
package world.bentobox.challenges.utils;
|
||||
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
|
||||
|
||||
/**
|
||||
* @author Daniel Saukel
|
||||
*
|
||||
* BONNe modified it for BentoBox by leaving only mob heads and removing unused code.
|
||||
*/
|
||||
public enum HeadLib
|
||||
{
|
||||
// ---------------------------------------------------------------------
|
||||
// Section: Library of All Mob heads
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* All enum values.
|
||||
*/
|
||||
SPIDER("8bdb71d0-4724-48b2-9344-e79480424798", "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvY2Q1NDE1NDFkYWFmZjUwODk2Y2QyNThiZGJkZDRjZjgwYzNiYTgxNjczNTcyNjA3OGJmZTM5MzkyN2U1N2YxIn19fQ=="),
|
||||
CAVE_SPIDER("39173a7a-c957-4ec1-ac1a-43e5a64983df", "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNDE2NDVkZmQ3N2QwOTkyMzEwN2IzNDk2ZTk0ZWViNWMzMDMyOWY5N2VmYzk2ZWQ3NmUyMjZlOTgyMjQifX19"),
|
||||
ENDERMAN("0de98464-1274-4dd6-bba8-370efa5d41a8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5taW5lY3JhZnQubmV0L3RleHR1cmUvNGIyZTliNjU4MWZlZDQ4YTk5ZTAzMjMwOTFhZDVjM2MzMjZjZGEyMDA3M2UyOGE5MDJhMDM3M2Y3MzgyYjU5ZiJ9fX0="),
|
||||
GOAT("acbab1c5-e323-3a61-ac37-58d0b2a546d1", "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvODc0NzNlMDU1ZGY2ZTdmZDk4NjY0ZTlmZGI2MzY3NWYwODgxMDYzMDVkNzQ0MDI0YTQxYmIzNTg5MThhMTQyYiJ9fX0=");
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Section: Variables
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* User UUID that has given skin.
|
||||
*/
|
||||
private String uuid;
|
||||
|
||||
/**
|
||||
* Base64 Encoded link to Minecraft texture.
|
||||
*/
|
||||
private String textureValue;
|
||||
|
||||
/**
|
||||
* Skull owner.
|
||||
*/
|
||||
private Object skullOwner;
|
||||
|
||||
/**
|
||||
* This map allows to access all enum values via their string.
|
||||
*/
|
||||
private final static Map<String, HeadLib> BY_NAME = new HashMap<>();
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Section: Constructor
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* This inits new enum value by given UUID and textureValue that is encoded in Base64.
|
||||
* @param uuid User UUID String which skin must be loaded.
|
||||
* @param textureValue Texture link encoded in Base64.
|
||||
*/
|
||||
HeadLib(String uuid, String textureValue)
|
||||
{
|
||||
this.uuid = uuid;
|
||||
this.textureValue = textureValue;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Section: Methods that returns ItemStacks
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Returns an ItemStack of the size 1 of the custom head.
|
||||
*
|
||||
* @return an ItemStack of the custom head.
|
||||
*/
|
||||
public ItemStack toItemStack()
|
||||
{
|
||||
return this.toItemStack(1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an ItemStack of the custom head.
|
||||
*
|
||||
* @param amount the amount of items in the stack
|
||||
* @return an ItemStack of the custom head.
|
||||
*/
|
||||
public ItemStack toItemStack(int amount)
|
||||
{
|
||||
return this.toItemStack(amount, null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an ItemStack of the size 1 of the custom head.
|
||||
*
|
||||
* @param displayName the name to display. Supports "&" color codes
|
||||
* @param loreLines optional lore lines. Supports "&" color codes
|
||||
* @return an ItemStack of the custom head.
|
||||
*/
|
||||
public ItemStack toItemStack(String displayName, String... loreLines)
|
||||
{
|
||||
return this.toItemStack(1, displayName, loreLines);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an ItemStack of the custom head.
|
||||
*
|
||||
* @param amount the amount of items in the stack
|
||||
* @param displayName the name to display. Supports "&" color codes
|
||||
* @param loreLines optional lore lines. Supports "&" color codes
|
||||
* @return an ItemStack of the custom head.
|
||||
*/
|
||||
public ItemStack toItemStack(int amount, String displayName, String... loreLines)
|
||||
{
|
||||
ItemStack item = new ItemStack(Material.PLAYER_HEAD, amount);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
|
||||
// Set Lora and DisplayName
|
||||
if (meta != null && displayName != null)
|
||||
{
|
||||
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', displayName));
|
||||
|
||||
if (loreLines.length != 0)
|
||||
{
|
||||
List<String> loreCC = new ArrayList<>();
|
||||
Arrays.stream(loreLines).forEach(l -> loreCC.add(ChatColor.translateAlternateColorCodes('&', l)));
|
||||
meta.setLore(loreCC);
|
||||
}
|
||||
|
||||
item.setItemMeta(meta);
|
||||
}
|
||||
|
||||
// Set correct Skull texture
|
||||
if (meta != null && this.textureValue != null && !this.textureValue.isEmpty())
|
||||
{
|
||||
GameProfile profile = new GameProfile(UUID.fromString(this.uuid), null);
|
||||
profile.getProperties().put("textures", new Property("textures", this.textureValue));
|
||||
|
||||
try
|
||||
{
|
||||
Field profileField = meta.getClass().getDeclaredField("profile");
|
||||
profileField.setAccessible(true);
|
||||
profileField.set(meta, profile);
|
||||
item.setItemMeta(meta);
|
||||
}
|
||||
catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e)
|
||||
{
|
||||
BentoBox.getInstance().log("Error while creating Skull Icon");
|
||||
}
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Section: Other methods
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* This method returns HeadLib enum object with given name. If enum value with given name does not exist,
|
||||
* then return null.
|
||||
* @param name Name of object that must be returned.
|
||||
* @return HeadLib with given name or null.
|
||||
*/
|
||||
public static HeadLib getHead(String name)
|
||||
{
|
||||
return BY_NAME.get(name.toUpperCase());
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// This static call populates all existing enum values into static map.
|
||||
//
|
||||
static
|
||||
{
|
||||
for (HeadLib head : values())
|
||||
{
|
||||
BY_NAME.put(head.name(), head);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user