More 1.21 fixes

This commit is contained in:
Jules 2024-07-25 20:37:12 -07:00
parent 41702be00d
commit be3aba8ab6
2 changed files with 11 additions and 11 deletions

View File

@ -1,5 +1,6 @@
package net.Indyuce.mmoitems;
import io.lumine.mythic.lib.UtilityMethods;
import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.api.util.ui.FriendlyFeedbackMessage;
import io.lumine.mythic.lib.api.util.ui.FriendlyFeedbackProvider;
@ -43,7 +44,6 @@ import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
@ -270,9 +270,7 @@ public class MMOItems extends MMOPlugin {
DeathItemsHandler.getActive().forEach(DeathItemsHandler::dropItems);
// Close inventories
for (Player player : Bukkit.getOnlinePlayers())
if (player.getOpenInventory() != null && player.getOpenInventory().getTopInventory().getHolder() instanceof PluginInventory)
player.closeInventory();
UtilityMethods.closeOpenViewsOfType(PluginInventory.class);
// WorldGen
this.worldGenManager.unload();

View File

@ -2,6 +2,8 @@ package net.Indyuce.mmoitems.gui.edition;
import io.lumine.mythic.lib.api.util.AltChar;
import io.lumine.mythic.lib.api.util.ui.FriendlyFeedbackProvider;
import io.lumine.mythic.lib.version.VInventoryView;
import io.lumine.mythic.lib.version.VersionUtils;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.ConfigFile;
import net.Indyuce.mmoitems.api.item.template.MMOItemTemplate;
@ -55,7 +57,7 @@ public abstract class EditionInventory extends PluginInventory {
* base item data
*
* @deprecated Not being used atm, the item editor only lets the user
* edit the base item data.
* edit the base item data.
*/
@Deprecated
private ModifierNode editedModifier = null;
@ -79,9 +81,9 @@ public abstract class EditionInventory extends PluginInventory {
// For building the Inventory
this.template = template;
this.configFile = template.getType().getConfigFile();
player.getOpenInventory();
if (player.getOpenInventory().getTopInventory().getHolder() instanceof EditionInventory)
this.cachedItem = ((EditionInventory) player.getOpenInventory().getTopInventory().getHolder()).cachedItem;
final VInventoryView open = VersionUtils.getOpen(player);
if (open.getTopInventory().getHolder() instanceof EditionInventory)
this.cachedItem = ((EditionInventory) open.getTopInventory().getHolder()).cachedItem;
}
@Override
@ -137,9 +139,9 @@ public abstract class EditionInventory extends PluginInventory {
/**
* @return The currently edited configuration section. It depends on if the
* player is editing the base item data or editing a modifier. This
* config section contains item data (either the 'base' config
* section or the 'stats' section for modifiers).
* player is editing the base item data or editing a modifier. This
* config section contains item data (either the 'base' config
* section or the 'stats' section for modifiers).
*/
public ConfigurationSection getEditedSection() {
ConfigurationSection config = configFile.getConfig().getConfigurationSection(template.getId());