Move InventoryView handling to separate modules
This commit is contained in:
@@ -1,4 +1,10 @@
|
|||||||
package dev.heliosares.auxprotect.utils;
|
package dev.heliosares.auxprotect.utils;
|
||||||
|
|
||||||
|
import org.bukkit.entity.HumanEntity;
|
||||||
|
import org.bukkit.inventory.Inventory;
|
||||||
|
|
||||||
public class InventoryUtil_1_20 {
|
public class InventoryUtil_1_20 {
|
||||||
|
public static Inventory getTopInventory(HumanEntity player) {
|
||||||
|
return player.getOpenInventory().getTopInventory();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
package dev.heliosares.auxprotect.utils;
|
package dev.heliosares.auxprotect.utils;
|
||||||
|
|
||||||
|
import org.bukkit.entity.HumanEntity;
|
||||||
|
import org.bukkit.inventory.Inventory;
|
||||||
|
|
||||||
public class InventoryUtil_1_21 {
|
public class InventoryUtil_1_21 {
|
||||||
|
public static Inventory getTopInventory(HumanEntity player) {
|
||||||
|
return player.getOpenInventory().getTopInventory();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,7 @@
|
|||||||
<artifactSet>
|
<artifactSet>
|
||||||
<includes>
|
<includes>
|
||||||
<include>org.json:json</include>
|
<include>org.json:json</include>
|
||||||
|
<include>dev.heliosares:*</include>
|
||||||
</includes>
|
</includes>
|
||||||
</artifactSet>
|
</artifactSet>
|
||||||
<minimizeJar>true</minimizeJar>
|
<minimizeJar>true</minimizeJar>
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import dev.heliosares.auxprotect.database.EntryAction;
|
|||||||
import dev.heliosares.auxprotect.database.SingleItemEntry;
|
import dev.heliosares.auxprotect.database.SingleItemEntry;
|
||||||
import dev.heliosares.auxprotect.spigot.AuxProtectSpigot;
|
import dev.heliosares.auxprotect.spigot.AuxProtectSpigot;
|
||||||
import dev.heliosares.auxprotect.utils.InvSerialization;
|
import dev.heliosares.auxprotect.utils.InvSerialization;
|
||||||
|
import dev.heliosares.auxprotect.utils.InventoryUtil_1_20;
|
||||||
|
import dev.heliosares.auxprotect.utils.InventoryUtil_1_21;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@@ -86,7 +88,11 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
InventoryType type;
|
InventoryType type;
|
||||||
|
|
||||||
type = e.getWhoClicked().getOpenInventory().getTopInventory().getType();
|
if (plugin.getCompatabilityVersion() < 21) {
|
||||||
|
type = InventoryUtil_1_20.getTopInventory(e.getWhoClicked()).getType();
|
||||||
|
} else {
|
||||||
|
type = InventoryUtil_1_21.getTopInventory(e.getWhoClicked()).getType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (e.getSlotType() != InventoryType.SlotType.RESULT) return;
|
if (e.getSlotType() != InventoryType.SlotType.RESULT) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user