From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Ivan Pekov Date: Thu, 10 Sep 2020 09:02:02 +0300 Subject: [PATCH] Respect permissions when constructing InventoryEnderChest Fixes Purpur-46 diff --git a/src/main/java/net/minecraft/server/InventoryEnderChest.java b/src/main/java/net/minecraft/server/InventoryEnderChest.java index d147377e5d2ee818f941f50f7392a1bc7f584ffb..fc83c50831feb73f5549ce709dc928a1047f87ab 100644 --- a/src/main/java/net/minecraft/server/InventoryEnderChest.java +++ b/src/main/java/net/minecraft/server/InventoryEnderChest.java @@ -25,6 +25,32 @@ public class InventoryEnderChest extends InventorySubcontainer { // CraftBukkit end } + // Yatopia start + @Override + public int getSize() { + if (owner != null && owner.getProfile() != null) { + if (net.pl3x.purpur.PurpurConfig.enderChestSixRows) { + if (net.pl3x.purpur.PurpurConfig.enderChestPermissionRows) { + org.bukkit.craftbukkit.entity.CraftHumanEntity bukkit = owner.getBukkitEntity(); + if (bukkit.hasPermission("purpur.enderchest.rows.six")) { + return 54; + } else if (bukkit.hasPermission("purpur.enderchest.rows.five")) { + return 45; + } else if (bukkit.hasPermission("purpur.enderchest.rows.four")) { + return 36; + } else if (bukkit.hasPermission("purpur.enderchest.rows.three")) { + return 27; + } else if (bukkit.hasPermission("purpur.enderchest.rows.two")) { + return 18; + } else if (bukkit.hasPermission("purpur.enderchest.rows.one")) { + return 9; + } else { /* prevent breakage */ return 54; } + } else { return 54; } + } else { return 27; } + } else { return net.pl3x.purpur.PurpurConfig.enderChestSixRows ? 54 : 27; } + } + // Yatopia end + public void a(TileEntityEnderChest tileentityenderchest) { this.a = tileentityenderchest; }