From a2e1fc19e8accf2997affb9b18be6187b1047bc6 Mon Sep 17 00:00:00 2001 From: GeorgH93 Date: Wed, 19 Jun 2024 09:02:40 +0200 Subject: [PATCH] Fix issue with paper and bungeecord setups --- .../Minepacks/Bukkit/Command/DebugCommand.java | 7 ++++--- .../src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java | 3 ++- pom.xml | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/DebugCommand.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/DebugCommand.java index f5eadce..f64e094 100644 --- a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/DebugCommand.java +++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/DebugCommand.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 GeorgH93 + * Copyright (C) 2024 GeorgH93 * * 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 @@ -19,13 +19,14 @@ import at.pcgamingfreaks.Bukkit.Message.Message; import at.pcgamingfreaks.Bukkit.Message.MessageBuilder; +import at.pcgamingfreaks.Bukkit.Util.InventoryUtils; import at.pcgamingfreaks.Bukkit.Util.Utils; import at.pcgamingfreaks.Command.HelpData; import at.pcgamingfreaks.Message.MessageClickEvent; import at.pcgamingfreaks.Message.MessageColor; import at.pcgamingfreaks.Message.MessageFormat; -import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksCommand; import at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack; +import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksCommand; import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks; import at.pcgamingfreaks.Minepacks.Bukkit.Permissions; @@ -119,7 +120,7 @@ private void debugSystem(final @NotNull CommandSender commandSender) sender.performCommand("backpack"); }, 5*20L); Bukkit.getServer().getScheduler().runTaskLater(plugin, () -> { - Bukkit.getPluginManager().callEvent(new ClickEvent(sender.getOpenInventory(), InventoryType.SlotType.QUICKBAR, sender.getOpenInventory().getTopInventory().getSize() + 27, ClickType.LEFT, InventoryAction.PICKUP_ALL)); + Bukkit.getPluginManager().callEvent(new ClickEvent(sender.getOpenInventory(), InventoryType.SlotType.QUICKBAR, InventoryUtils.getPlayerTopInventory(sender).getSize() + 27, ClickType.LEFT, InventoryAction.PICKUP_ALL)); }, 10*20L); Bukkit.getServer().getScheduler().runTaskLater(plugin, sender::closeInventory, 20*20L); Bukkit.getServer().getScheduler().runTaskLater(plugin, () -> { diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java index 660e7db..d155f01 100644 --- a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java +++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java @@ -21,6 +21,7 @@ import at.pcgamingfreaks.Bukkit.MCVersion; import at.pcgamingfreaks.Bukkit.ManagedUpdater; import at.pcgamingfreaks.Bukkit.Message.Message; +import at.pcgamingfreaks.Bukkit.Util.InventoryUtils; import at.pcgamingfreaks.Bukkit.Util.Utils; import at.pcgamingfreaks.ConsoleColor; import at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack; @@ -321,7 +322,7 @@ public void openBackpack(@NotNull Player opener, @Nullable Backpack backpack, bo return; } //noinspection ObjectEquality - if(opener.getOpenInventory().getTopInventory().getHolder() == backpack) return; // == is fine as there is only one instance of each backpack + if(InventoryUtils.getPlayerTopInventory(opener).getHolder() == backpack) return; // == is fine as there is only one instance of each backpack if(openSound != null) { opener.playSound(opener.getLocation(), openSound, 1, 0); diff --git a/pom.xml b/pom.xml index 5a87b34..a2407ed 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ pom - 2.4.31.1 + 2.4.31.2 UTF-8 UTF-8