Skip to content

Commit

Permalink
Replace GuiUtils and HeadLib to the PanelUtils library.
Browse files Browse the repository at this point in the history
  • Loading branch information
BONNe committed Oct 2, 2021
1 parent e4f9361 commit e9f37e8
Show file tree
Hide file tree
Showing 20 changed files with 89 additions and 753 deletions.
48 changes: 45 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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. -->
Expand Down Expand Up @@ -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>
Expand All @@ -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>
Expand Down Expand Up @@ -190,7 +199,6 @@
<version>1.5.21</version>
<scope>provided</scope>
</dependency>

</dependencies>

<build>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public IslandRequirements()
/**
* 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()
{
Expand Down Expand Up @@ -83,7 +83,7 @@ public void setRemoveBlocks(boolean removeBlocks)
/**
* 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()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
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;
Expand All @@ -20,7 +21,6 @@
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;

Expand Down Expand Up @@ -84,7 +84,7 @@ protected void build()
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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
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;
Expand All @@ -28,7 +29,6 @@
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;


Expand Down Expand Up @@ -125,7 +125,7 @@ protected void build()
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));
Expand Down Expand Up @@ -1330,7 +1330,7 @@ private PanelItem createStatisticRequirementButton(RequirementButton button)

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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
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;
Expand All @@ -27,7 +28,6 @@
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;


Expand Down Expand Up @@ -131,7 +131,7 @@ protected void build()
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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
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;
Expand All @@ -23,7 +24,6 @@
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;


Expand Down Expand Up @@ -105,7 +105,7 @@ protected void build()
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));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
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;
Expand All @@ -24,7 +25,6 @@
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;

Expand Down Expand Up @@ -182,7 +182,7 @@ protected void build()
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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
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;
Expand All @@ -19,7 +20,6 @@
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;


Expand Down Expand Up @@ -119,11 +119,11 @@ protected void build()

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).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,18 @@
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;


Expand Down Expand Up @@ -120,11 +119,11 @@ protected void build()

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).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
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;
Expand All @@ -24,7 +25,6 @@
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;


Expand Down Expand Up @@ -135,7 +135,7 @@ protected void build()
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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
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;
Expand All @@ -21,7 +22,6 @@
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;


Expand Down Expand Up @@ -93,7 +93,7 @@ protected void build()
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));
Expand Down Expand Up @@ -233,7 +233,7 @@ protected PanelItem createElementButton(Material 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.
Expand Down

0 comments on commit e9f37e8

Please sign in to comment.