diff --git a/pom.xml b/pom.xml
index b15a1bc..78098fe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,6 +41,10 @@
https://repo.codemc.org/repository/maven-public
+
+ sytm-nexus
+ https://repo.sytm.de/repository/maven-hosted/
+
@@ -60,10 +64,16 @@
3.4
+
+
+
+
+
+
fr.minuskube.inv
smart-invs
- 1.2.7
+ 1.3.0-SNAPSHOT
diff --git a/src/main/java/com/jamesdpeters/minecraft/chests/inventories/ChestLinkInventory.java b/src/main/java/com/jamesdpeters/minecraft/chests/inventories/ChestLinkInventory.java
index 06372c8..ef22230 100644
--- a/src/main/java/com/jamesdpeters/minecraft/chests/inventories/ChestLinkInventory.java
+++ b/src/main/java/com/jamesdpeters/minecraft/chests/inventories/ChestLinkInventory.java
@@ -39,9 +39,9 @@ public class ChestLinkInventory implements InventoryProvider {
@Override
public void init(Player player, InventoryContents contents) {
Pagination pagination = contents.pagination();
- List itemList = new ArrayList<>();
-
- pagination.setItems(itemList.toArray(new ClickableItem[0]));
+// List itemList = new ArrayList<>();
+//
+// pagination.setItems(itemList.toArray(new ClickableItem[0]));
pagination.setItemsPerPage(28);
contents.fillBorders(ClickableItem.empty(Utils.getNamedItem(new ItemStack(Material.GRAY_STAINED_GLASS_PANE)," ")));
@@ -49,9 +49,9 @@ public class ChestLinkInventory implements InventoryProvider {
contents.add(item);
}
- contents.set(5, 2, ClickableItem.of(Utils.getNamedItem(new ItemStack(Material.ARROW),"Previous"),
+ contents.set(2, 2, ClickableItem.from(Utils.getNamedItem(new ItemStack(Material.ARROW),"Previous"),
e -> inventory.open(player, pagination.previous().getPage())));
- contents.set(5, 6, ClickableItem.of(Utils.getNamedItem(new ItemStack(Material.ARROW),"Next"),
+ contents.set(2, 6, ClickableItem.from(Utils.getNamedItem(new ItemStack(Material.ARROW),"Next"),
e -> inventory.open(player, pagination.next().getPage())));
}
diff --git a/src/main/java/com/jamesdpeters/minecraft/chests/inventories/ChestLinkMenu.java b/src/main/java/com/jamesdpeters/minecraft/chests/inventories/ChestLinkMenu.java
index 966b6f5..e16ae29 100644
--- a/src/main/java/com/jamesdpeters/minecraft/chests/inventories/ChestLinkMenu.java
+++ b/src/main/java/com/jamesdpeters/minecraft/chests/inventories/ChestLinkMenu.java
@@ -9,8 +9,10 @@ import fr.minuskube.inv.SmartInventory;
import fr.minuskube.inv.content.InventoryContents;
import fr.minuskube.inv.content.InventoryProvider;
import fr.minuskube.inv.content.Pagination;
+import fr.minuskube.inv.content.SlotPos;
import org.bukkit.Material;
import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.ItemStack;
import java.util.ArrayList;
@@ -32,6 +34,7 @@ public class ChestLinkMenu implements InventoryProvider {
.title("Inventory Storage")
.provider(this)
.manager(ChestsPlusPlus.INVENTORY_MANAGER)
+ .size(6,9)
.build();
//menu.setInsertable(true);
}
@@ -53,21 +56,20 @@ public class ChestLinkMenu implements InventoryProvider {
List itemList = new ArrayList<>();
for(InventoryStorage storage : storages){
ClickableItem item = storage.getClickableItem(player);
- //item.setRemoveable(true);
itemList.add(item);
}
pagination.setItems(itemList.toArray(new ClickableItem[0]));
- pagination.setItemsPerPage(28);
+ pagination.setItemsPerPage(54);
contents.fillBorders(ClickableItem.empty(Utils.getNamedItem(new ItemStack(Material.GRAY_STAINED_GLASS_PANE)," ")));
for(ClickableItem item : pagination.getPageItems()){
contents.add(item);
}
- contents.set(5, 2, ClickableItem.of(Utils.getNamedItem(new ItemStack(Material.ARROW),"Previous"),
+ contents.set(5, 2, ClickableItem.from(Utils.getNamedItem(new ItemStack(Material.ARROW),"Previous"),
e -> menu.open(player, pagination.previous().getPage())));
- contents.set(5, 6, ClickableItem.of(Utils.getNamedItem(new ItemStack(Material.ARROW),"Next"),
+ contents.set(5, 6, ClickableItem.from(Utils.getNamedItem(new ItemStack(Material.ARROW),"Next"),
e -> menu.open(player, pagination.next().getPage())));
}
diff --git a/src/main/java/com/jamesdpeters/minecraft/chests/misc/Utils.java b/src/main/java/com/jamesdpeters/minecraft/chests/misc/Utils.java
index 85d932b..b7aad28 100644
--- a/src/main/java/com/jamesdpeters/minecraft/chests/misc/Utils.java
+++ b/src/main/java/com/jamesdpeters/minecraft/chests/misc/Utils.java
@@ -240,21 +240,21 @@ public class Utils {
return getPlayersAsNameList(Bukkit.getOnlinePlayers());
}
- public static List getPlayersAsNameList(Collection extends Player> players){
+ public static List getPlayersAsNameList(Collection extends OfflinePlayer> players){
List arr = new ArrayList<>();
- for(Player player : players){
- arr.add(ChatColor.stripColor(player.getDisplayName()));
+ for(OfflinePlayer player : players){
+ arr.add(ChatColor.stripColor(player.getName()));
}
return arr;
}
- public static String prettyPrintPlayers(ChatColor highlight, List players){
+ public static String prettyPrintPlayers(ChatColor highlight, List players){
StringBuilder str = new StringBuilder();
str.append(players.size());
if(players.size() > 0) {
str.append(" - " + highlight + "[");
- for (Player player : players) {
- str.append(ChatColor.WHITE + ChatColor.stripColor(player.getDisplayName())).append(", ");
+ for (OfflinePlayer player : players) {
+ str.append(ChatColor.WHITE + ChatColor.stripColor(player.getName())).append(", ");
}
str.delete(str.length() - 2, str.length());
str.append(highlight + "]");
diff --git a/src/main/java/com/jamesdpeters/minecraft/chests/serialize/InventoryStorage.java b/src/main/java/com/jamesdpeters/minecraft/chests/serialize/InventoryStorage.java
index f11d261..b68c6cb 100644
--- a/src/main/java/com/jamesdpeters/minecraft/chests/serialize/InventoryStorage.java
+++ b/src/main/java/com/jamesdpeters/minecraft/chests/serialize/InventoryStorage.java
@@ -6,10 +6,7 @@ import com.jamesdpeters.minecraft.chests.misc.Utils;
import com.jamesdpeters.minecraft.chests.interfaces.VirtualInventoryHolder;
import com.jamesdpeters.minecraft.chests.runnables.VirtualChestToHopper;
import fr.minuskube.inv.ClickableItem;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.Location;
-import org.bukkit.Material;
+import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.block.Chest;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
@@ -19,14 +16,14 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
public class InventoryStorage implements ConfigurationSerializable {
Inventory inventory; //Old Inventory
- ArrayList items;
ArrayList locationsList;
ArrayList members; //Members UUID
- List bukkitMembers;
+ List bukkitMembers;
String inventoryName = "Chest";
VirtualChestToHopper chestToHopper;
Player player;
@@ -62,7 +59,7 @@ public class InventoryStorage implements ConfigurationSerializable {
members = (ArrayList) map.get("members");
bukkitMembers = new ArrayList<>();
for(String uuid : members){
- bukkitMembers.add(Bukkit.getOfflinePlayer(UUID.fromString(uuid)).getPlayer());
+ bukkitMembers.add(Bukkit.getOfflinePlayer(UUID.fromString(uuid)));
}
}
@@ -138,7 +135,13 @@ public class InventoryStorage implements ConfigurationSerializable {
ItemMeta meta = toReturn.getItemMeta();
if(meta != null) {
- meta.setDisplayName(ChatColor.BOLD + "" + ChatColor.GREEN + "" + getIdentifier());
+ meta.setDisplayName(ChatColor.BOLD + "" + ChatColor.GREEN + "" + getIdentifier() + ": " +ChatColor.WHITE+ ""+getTotalItems()+" items");
+ if(getMembers() != null) {
+ List memberNames = new ArrayList<>();
+ memberNames.add(ChatColor.BOLD+""+ChatColor.UNDERLINE+"Members:");
+ getMembers().forEach(player1 -> memberNames.add(ChatColor.stripColor(player1.getName())));
+ meta.setLore(memberNames);
+ }
toReturn.setItemMeta(meta);
}
toReturn.setAmount(1);
@@ -146,7 +149,7 @@ public class InventoryStorage implements ConfigurationSerializable {
}
public ClickableItem getClickableItem(Player player) {
- return ClickableItem.of(getIventoryIcon(), event -> {
+ return ClickableItem.from(getIventoryIcon(), event -> {
Utils.openInventory(player,getInventory());
});
}
@@ -185,7 +188,17 @@ public class InventoryStorage implements ConfigurationSerializable {
return false;
}
- public List getMembers(){
+ public List getMembers(){
return bukkitMembers;
}
+
+ public int getTotalItems(){
+ int total = 0;
+ if(inventory != null) {
+ for(ItemStack itemStack : inventory.getContents()){
+ if(itemStack != null) total += itemStack.getAmount();
+ }
+ }
+ return total;
+ }
}