Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Commit

Permalink
Updated GitHub repository. Added ability to change menu control names…
Browse files Browse the repository at this point in the history
…. Added new variables to `clangui.yml`. Changed PlaceholderAPI expansion version to `1.3.6`. Changed plugin version to `1.3.6`.
  • Loading branch information
BuildTools committed Mar 7, 2023
1 parent a6095c3 commit 0a92be9
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>xyz.gamlin</groupId>
<artifactId>ClansLite</artifactId>
<version>1.3.5</version>
<version>1.3.6</version>
<packaging>jar</packaging>

<name>ClansLite</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class PlayerClanExpansion extends PlaceholderExpansion {

@Override
public @NotNull String getVersion() {
return "1.3.5";
return "1.3.6";
}

@Override
Expand Down
12 changes: 8 additions & 4 deletions src/main/java/xyz/gamlin/clans/menuSystem/PaginatedMenu.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package xyz.gamlin.clans.menuSystem;

import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration;
import xyz.gamlin.clans.Clans;
import xyz.gamlin.clans.utils.ColorUtils;

public abstract class PaginatedMenu extends Menu {

FileConfiguration guiConfig = Clans.getPlugin().clanGUIFileManager.getClanGUIConfig();

protected int page = 0;
protected int maxItemsPerPage = 45;
protected int index = 0;
Expand All @@ -14,9 +18,9 @@ public PaginatedMenu(PlayerMenuUtility playerMenuUtility) {
}

public void addMenuControls(){
inventory.setItem(48, makeItem(Material.STONE_BUTTON, ChatColor.GREEN + "Previous Page"));
inventory.setItem(49, makeItem(Material.BARRIER, ChatColor.DARK_RED + "Close/Go Back"));
inventory.setItem(50, makeItem(Material.STONE_BUTTON, ChatColor.GREEN + "Next Page"));
inventory.setItem(48, makeItem(Material.STONE_BUTTON, ColorUtils.translateColorCodes(guiConfig.getString("clan-list.menu-controls.previous-page-icon-name"))));
inventory.setItem(49, makeItem(Material.BARRIER, ColorUtils.translateColorCodes(guiConfig.getString("clan-list.menu-controls.close-go-back-icon-name"))));
inventory.setItem(50, makeItem(Material.STONE_BUTTON, ColorUtils.translateColorCodes(guiConfig.getString("clan-list.menu-controls.next-page-icon-name"))));
}

public int getMaxItemsPerPage() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ public void handleMenu(InventoryClickEvent event) {
}
}
}else if(event.getCurrentItem().getType().equals(Material.STONE_BUTTON)){
if (ChatColor.stripColor(event.getCurrentItem().getItemMeta().getDisplayName()).equalsIgnoreCase("Previous Page")){
if (event.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase(ColorUtils.translateColorCodes(guiConfig.getString("clan-list.menu-controls.previous-page-icon-name")))){
if (page == 0){
player.sendMessage(ColorUtils.translateColorCodes(guiConfig.getString("clan-list.GUI-first-page")));
}else{
page = page - 1;
super.open();
}
}else if (ChatColor.stripColor(event.getCurrentItem().getItemMeta().getDisplayName()).equalsIgnoreCase("Next Page")){
}else if (event.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase(ColorUtils.translateColorCodes(guiConfig.getString("clan-list.menu-controls.next-page-icon-name")))){
if (!((index + 1) >= clans.size())){
page = page + 1;
super.open();
Expand Down
9 changes: 9 additions & 0 deletions src/main/resources/clangui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ clan-list:
#Message sent when your on the last page.
GUI-last-page: "&7You are on the last page."

#Menu controls options
menu-controls:
#The name of the previous page icon
previous-page-icon-name: "&2Previous Page"
#The name of the next page icon
next-page-icon-name: "&2Next Page"
#The name of the close/go back icon
close-go-back-icon-name: "&4Close/Go Back"

icons:
#Do you want to use the auto data update system for the icons in the GUI? [Default value: true]
##Disabling this option may help performance on lower spec servers!##
Expand Down

0 comments on commit 0a92be9

Please sign in to comment.