Fix advancement-related memory leak (#104)

Fix memory leak with loaded players' advancements
Fix missing transaction transfer for player inventories
Fix incorrect transaction transfer for ender chests
Minor code health
This commit is contained in:
Adam
2022-10-14 16:40:33 -04:00
committed by GitHub
parent c443615c1d
commit 0120d35a9a
9 changed files with 125 additions and 58 deletions

View File

@@ -476,8 +476,9 @@ public class OpenInv extends JavaPlugin implements IOpenInv {
if (!disableSaving()
&& current != null
&& current.getPlayer() instanceof Player player && !player.isOnline()) {
this.accessor.getPlayerDataManager().inject(player).saveData();
&& current.getPlayer() instanceof Player player
&& !player.isOnline()) {
this.accessor.getPlayerDataManager().inject(player).saveData();
}
});
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2011-2021 lishid. All rights reserved.
* Copyright (C) 2011-2022 lishid. All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@@ -27,13 +27,17 @@ import org.jetbrains.annotations.NotNull;
public class OpenInventoryView extends InventoryView {
private final Player player;
private final ISpecialInventory inventory;
private final String titleKey;
private final String titleDefaultSuffix;
private final @NotNull Player player;
private final @NotNull ISpecialInventory inventory;
private final @NotNull String titleKey;
private final @NotNull String titleDefaultSuffix;
private String title;
public OpenInventoryView(Player player, ISpecialInventory inventory, String titleKey, String titleDefaultSuffix) {
public OpenInventoryView(
@NotNull Player player,
@NotNull ISpecialInventory inventory,
@NotNull String titleKey,
@NotNull String titleDefaultSuffix) {
this.player = player;
this.inventory = inventory;
this.titleKey = titleKey;