Fix issue with paper and bungeecord setups

This commit is contained in:
GeorgH93 2024-06-19 09:02:40 +02:00
parent 9a9a94673d
commit a2e1fc19e8
No known key found for this signature in database
GPG Key ID: D1630D37F9E4B3C8
3 changed files with 7 additions and 5 deletions

View File

@ -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, () -> {

View File

@ -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);

View File

@ -7,7 +7,7 @@
<packaging>pom</packaging>
<properties>
<revision>2.4.31.1</revision>
<revision>2.4.31.2</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>