Fix reordering issue on non-full vault sizes:
No longer tries to save a 6 row vault unless the vault has 6 rows.
This commit is contained in:
@@ -52,7 +52,7 @@ public class Listeners implements Listener {
|
|||||||
public void saveVault(Player player, Inventory inventory) {
|
public void saveVault(Player player, Inventory inventory) {
|
||||||
if (plugin.getInVault().containsKey(player.getUniqueId().toString())) {
|
if (plugin.getInVault().containsKey(player.getUniqueId().toString())) {
|
||||||
|
|
||||||
Inventory inv = Bukkit.createInventory(null, 6 * 9);
|
Inventory inv = Bukkit.createInventory(null, inventory.getSize());
|
||||||
inv.setContents(inventory.getContents().clone());
|
inv.setContents(inventory.getContents().clone());
|
||||||
|
|
||||||
PlayerVaults.debug(inventory.getType() + " " + inventory.getClass().getSimpleName());
|
PlayerVaults.debug(inventory.getType() + " " + inventory.getClass().getSimpleName());
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ public class VaultManager {
|
|||||||
// Happens on change of permission or if people used the broken version.
|
// Happens on change of permission or if people used the broken version.
|
||||||
// In this case, players will lose items.
|
// In this case, players will lose items.
|
||||||
if (deserialized.length > size) {
|
if (deserialized.length > size) {
|
||||||
|
PlayerVaults.debug("Loaded vault for " + ownerName + " and got " + deserialized.length + " items for allowed size of " + size+". Attempting to rescue!");
|
||||||
for (ItemStack stack : deserialized) {
|
for (ItemStack stack : deserialized) {
|
||||||
if (stack != null) {
|
if (stack != null) {
|
||||||
inventory.addItem(stack);
|
inventory.addItem(stack);
|
||||||
|
|||||||
Reference in New Issue
Block a user