From 802ce28103679d987a70635fb2d2fe697dd7a1fd Mon Sep 17 00:00:00 2001 From: Jikoo Date: Mon, 5 Dec 2016 19:02:43 -0500 Subject: [PATCH] Fix issue caused by module cleanup while backporting awarding achievement --- .../internal/v1_10_R1/AnySilentContainer.java | 19 +++++++++++-------- .../internal/v1_11_R1/AnySilentContainer.java | 4 ++-- .../internal/v1_8_R1/AnySilentContainer.java | 15 +++++++++------ .../internal/v1_8_R2/AnySilentContainer.java | 19 +++++++++++-------- .../internal/v1_8_R3/AnySilentContainer.java | 19 +++++++++++-------- .../internal/v1_9_R1/AnySilentContainer.java | 15 +++++++++------ .../internal/v1_9_R2/AnySilentContainer.java | 19 +++++++++++-------- 7 files changed, 64 insertions(+), 46 deletions(-) diff --git a/internal/v1_10_R1/src/main/java/com/lishid/openinv/internal/v1_10_R1/AnySilentContainer.java b/internal/v1_10_R1/src/main/java/com/lishid/openinv/internal/v1_10_R1/AnySilentContainer.java index 8e3a01c..36c3ae9 100644 --- a/internal/v1_10_R1/src/main/java/com/lishid/openinv/internal/v1_10_R1/AnySilentContainer.java +++ b/internal/v1_10_R1/src/main/java/com/lishid/openinv/internal/v1_10_R1/AnySilentContainer.java @@ -29,6 +29,7 @@ import net.minecraft.server.v1_10_R1.BlockChest; import net.minecraft.server.v1_10_R1.BlockChest.Type; import net.minecraft.server.v1_10_R1.BlockEnderChest; import net.minecraft.server.v1_10_R1.BlockPosition; +import net.minecraft.server.v1_10_R1.Container; import net.minecraft.server.v1_10_R1.Entity; import net.minecraft.server.v1_10_R1.EntityOcelot; import net.minecraft.server.v1_10_R1.EntityPlayer; @@ -145,6 +146,7 @@ public class AnySilentContainer implements IAnySilentContainer { } Block block = world.getType(blockPosition).getBlock(); + Container container = null; if (block instanceof BlockChest) { for (EnumDirection localEnumDirection : EnumDirection.EnumDirectionLimit.HORIZONTAL) { @@ -171,26 +173,27 @@ public class AnySilentContainer implements IAnySilentContainer { } if (silentchest) { - tile = new SilentContainerChest(player.inventory, ((IInventory) tile), player); + container = new SilentContainerChest(player.inventory, ((IInventory) tile), player); } - if (((BlockChest) block).g == Type.BASIC) + if (((BlockChest) block).g == Type.BASIC) { player.b(StatisticList.ac); - else if (((BlockChest) block).g == Type.TRAP) { + } else if (((BlockChest) block).g == Type.TRAP) { player.b(StatisticList.W); } } boolean returnValue = false; - if (!silentchest) { - player.openContainer((IInventory) tile); + final IInventory iInventory = (IInventory) tile; + + if (!silentchest || container == null) { + player.openContainer(iInventory); returnValue = true; } else { try { - SilentContainerChest silentContainerChest = new SilentContainerChest(player.inventory, ((IInventory) tile), player); int windowId = player.nextContainerCounter(); - player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(windowId, "minecraft:chest", ((IInventory) tile).getScoreboardDisplayName(), ((IInventory) tile).getSize())); - player.activeContainer = silentContainerChest; + player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(windowId, iInventory.getName(), iInventory.getScoreboardDisplayName(), iInventory.getSize())); + player.activeContainer = container; player.activeContainer.windowId = windowId; player.activeContainer.addSlotListener(player); returnValue = true; diff --git a/internal/v1_11_R1/src/main/java/com/lishid/openinv/internal/v1_11_R1/AnySilentContainer.java b/internal/v1_11_R1/src/main/java/com/lishid/openinv/internal/v1_11_R1/AnySilentContainer.java index bd084ba..55b1d53 100644 --- a/internal/v1_11_R1/src/main/java/com/lishid/openinv/internal/v1_11_R1/AnySilentContainer.java +++ b/internal/v1_11_R1/src/main/java/com/lishid/openinv/internal/v1_11_R1/AnySilentContainer.java @@ -211,9 +211,9 @@ public class AnySilentContainer implements IAnySilentContainer { break; } - if (blockChest.g == Type.BASIC) + if (blockChest.g == Type.BASIC) { player.b(StatisticList.ac); - else if (blockChest.g == Type.TRAP) { + } else if (blockChest.g == Type.TRAP) { player.b(StatisticList.W); } diff --git a/internal/v1_8_R1/src/main/java/com/lishid/openinv/internal/v1_8_R1/AnySilentContainer.java b/internal/v1_8_R1/src/main/java/com/lishid/openinv/internal/v1_8_R1/AnySilentContainer.java index 6968d2d..a3768e1 100644 --- a/internal/v1_8_R1/src/main/java/com/lishid/openinv/internal/v1_8_R1/AnySilentContainer.java +++ b/internal/v1_8_R1/src/main/java/com/lishid/openinv/internal/v1_8_R1/AnySilentContainer.java @@ -28,6 +28,7 @@ import net.minecraft.server.v1_8_R1.Block; import net.minecraft.server.v1_8_R1.BlockChest; import net.minecraft.server.v1_8_R1.BlockEnderChest; import net.minecraft.server.v1_8_R1.BlockPosition; +import net.minecraft.server.v1_8_R1.Container; import net.minecraft.server.v1_8_R1.EntityOcelot; import net.minecraft.server.v1_8_R1.EntityPlayer; import net.minecraft.server.v1_8_R1.EnumDirection; @@ -145,6 +146,7 @@ public class AnySilentContainer implements IAnySilentContainer { } Block block = world.getType(blockPosition).getBlock(); + Container container = null; if (block instanceof BlockChest) { for (EnumDirection localEnumDirection : EnumDirection.values()) { @@ -176,20 +178,21 @@ public class AnySilentContainer implements IAnySilentContainer { } if (silentchest) { - tile = new SilentContainerChest(player.inventory, ((IInventory) tile), player); + container = new SilentContainerChest(player.inventory, ((IInventory) tile), player); } } boolean returnValue = false; - if (!silentchest) { - player.openContainer((IInventory) tile); + final IInventory iInventory = (IInventory) tile; + + if (!silentchest || container == null) { + player.openContainer(iInventory); returnValue = true; } else { try { - SilentContainerChest silentContainerChest = new SilentContainerChest(player.inventory, ((IInventory) tile), player); int windowId = player.nextContainerCounter(); - player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(windowId, "minecraft:chest", ((IInventory) tile).getScoreboardDisplayName(), ((IInventory) tile).getSize())); - player.activeContainer = silentContainerChest; + player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(windowId, iInventory.getName(), iInventory.getScoreboardDisplayName(), iInventory.getSize())); + player.activeContainer = container; player.activeContainer.windowId = windowId; player.activeContainer.addSlotListener(player); returnValue = true; diff --git a/internal/v1_8_R2/src/main/java/com/lishid/openinv/internal/v1_8_R2/AnySilentContainer.java b/internal/v1_8_R2/src/main/java/com/lishid/openinv/internal/v1_8_R2/AnySilentContainer.java index ebf2042..564fdcc 100644 --- a/internal/v1_8_R2/src/main/java/com/lishid/openinv/internal/v1_8_R2/AnySilentContainer.java +++ b/internal/v1_8_R2/src/main/java/com/lishid/openinv/internal/v1_8_R2/AnySilentContainer.java @@ -28,6 +28,7 @@ import net.minecraft.server.v1_8_R2.Block; import net.minecraft.server.v1_8_R2.BlockChest; import net.minecraft.server.v1_8_R2.BlockEnderChest; import net.minecraft.server.v1_8_R2.BlockPosition; +import net.minecraft.server.v1_8_R2.Container; import net.minecraft.server.v1_8_R2.Entity; import net.minecraft.server.v1_8_R2.EntityOcelot; import net.minecraft.server.v1_8_R2.EntityPlayer; @@ -144,6 +145,7 @@ public class AnySilentContainer implements IAnySilentContainer { } Block block = world.getType(blockPosition).getBlock(); + Container container = null; if (block instanceof BlockChest) { for (EnumDirection localEnumDirection : EnumDirection.EnumDirectionLimit.HORIZONTAL) { @@ -170,26 +172,27 @@ public class AnySilentContainer implements IAnySilentContainer { } if (silentchest) { - tile = new SilentContainerChest(player.inventory, ((IInventory) tile), player); + container = new SilentContainerChest(player.inventory, ((IInventory) tile), player); } - if (((BlockChest) block).b == 0) + if (((BlockChest) block).b == 0) { player.b(StatisticList.aa); - else if (((BlockChest) block).b == 1) { + } else if (((BlockChest) block).b == 1) { player.b(StatisticList.U); } } boolean returnValue = false; - if (!silentchest) { - player.openContainer((IInventory) tile); + final IInventory iInventory = (IInventory) tile; + + if (!silentchest || container == null) { + player.openContainer(iInventory); returnValue = true; } else { try { - SilentContainerChest silentContainerChest = new SilentContainerChest(player.inventory, ((IInventory) tile), player); int windowId = player.nextContainerCounter(); - player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(windowId, "minecraft:chest", ((IInventory) tile).getScoreboardDisplayName(), ((IInventory) tile).getSize())); - player.activeContainer = silentContainerChest; + player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(windowId, iInventory.getName(), iInventory.getScoreboardDisplayName(), iInventory.getSize())); + player.activeContainer = container; player.activeContainer.windowId = windowId; player.activeContainer.addSlotListener(player); returnValue = true; diff --git a/internal/v1_8_R3/src/main/java/com/lishid/openinv/internal/v1_8_R3/AnySilentContainer.java b/internal/v1_8_R3/src/main/java/com/lishid/openinv/internal/v1_8_R3/AnySilentContainer.java index ec13927..6d2f3c3 100644 --- a/internal/v1_8_R3/src/main/java/com/lishid/openinv/internal/v1_8_R3/AnySilentContainer.java +++ b/internal/v1_8_R3/src/main/java/com/lishid/openinv/internal/v1_8_R3/AnySilentContainer.java @@ -28,6 +28,7 @@ import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_8_R3.BlockChest; import net.minecraft.server.v1_8_R3.BlockEnderChest; import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.Container; import net.minecraft.server.v1_8_R3.Entity; import net.minecraft.server.v1_8_R3.EntityOcelot; import net.minecraft.server.v1_8_R3.EntityPlayer; @@ -144,6 +145,7 @@ public class AnySilentContainer implements IAnySilentContainer { } Block block = world.getType(blockPosition).getBlock(); + Container container = null; if (block instanceof BlockChest) { for (EnumDirection localEnumDirection : EnumDirection.EnumDirectionLimit.HORIZONTAL) { @@ -170,26 +172,27 @@ public class AnySilentContainer implements IAnySilentContainer { } if (silentchest) { - tile = new SilentContainerChest(player.inventory, ((IInventory) tile), player); + container = new SilentContainerChest(player.inventory, ((IInventory) tile), player); } - if (((BlockChest) block).b == 0) + if (((BlockChest) block).b == 0) { player.b(StatisticList.aa); - else if (((BlockChest) block).b == 1) { + } else if (((BlockChest) block).b == 1) { player.b(StatisticList.U); } } boolean returnValue = false; - if (!silentchest) { - player.openContainer((IInventory) tile); + final IInventory iInventory = (IInventory) tile; + + if (!silentchest || container == null) { + player.openContainer(iInventory); returnValue = true; } else { try { - SilentContainerChest silentContainerChest = new SilentContainerChest(player.inventory, ((IInventory) tile), player); int windowId = player.nextContainerCounter(); - player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(windowId, "minecraft:chest", ((IInventory) tile).getScoreboardDisplayName(), ((IInventory) tile).getSize())); - player.activeContainer = silentContainerChest; + player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(windowId, iInventory.getName(), iInventory.getScoreboardDisplayName(), iInventory.getSize())); + player.activeContainer = container; player.activeContainer.windowId = windowId; player.activeContainer.addSlotListener(player); returnValue = true; diff --git a/internal/v1_9_R1/src/main/java/com/lishid/openinv/internal/v1_9_R1/AnySilentContainer.java b/internal/v1_9_R1/src/main/java/com/lishid/openinv/internal/v1_9_R1/AnySilentContainer.java index eaf4f2f..536f3ae 100644 --- a/internal/v1_9_R1/src/main/java/com/lishid/openinv/internal/v1_9_R1/AnySilentContainer.java +++ b/internal/v1_9_R1/src/main/java/com/lishid/openinv/internal/v1_9_R1/AnySilentContainer.java @@ -28,6 +28,7 @@ import net.minecraft.server.v1_9_R1.Block; import net.minecraft.server.v1_9_R1.BlockChest; import net.minecraft.server.v1_9_R1.BlockEnderChest; import net.minecraft.server.v1_9_R1.BlockPosition; +import net.minecraft.server.v1_9_R1.Container; import net.minecraft.server.v1_9_R1.Entity; import net.minecraft.server.v1_9_R1.EntityOcelot; import net.minecraft.server.v1_9_R1.EntityPlayer; @@ -144,6 +145,7 @@ public class AnySilentContainer implements IAnySilentContainer { } Block block = world.getType(blockPosition).getBlock(); + Container container = null; if (block instanceof BlockChest) { for (EnumDirection localEnumDirection : EnumDirection.EnumDirectionLimit.HORIZONTAL) { @@ -170,7 +172,7 @@ public class AnySilentContainer implements IAnySilentContainer { } if (silentchest) { - tile = new SilentContainerChest(player.inventory, ((IInventory) tile), player); + container = new SilentContainerChest(player.inventory, ((IInventory) tile), player); } if (((BlockChest) block).g == BlockChest.Type.BASIC) @@ -181,15 +183,16 @@ public class AnySilentContainer implements IAnySilentContainer { } boolean returnValue = false; - if (!silentchest) { - player.openContainer((IInventory) tile); + final IInventory iInventory = (IInventory) tile; + + if (!silentchest || container == null) { + player.openContainer(iInventory); returnValue = true; } else { try { - SilentContainerChest silentContainerChest = new SilentContainerChest(player.inventory, ((IInventory) tile), player); int windowId = player.nextContainerCounter(); - player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(windowId, "minecraft:chest", ((IInventory) tile).getScoreboardDisplayName(), ((IInventory) tile).getSize())); - player.activeContainer = silentContainerChest; + player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(windowId, iInventory.getName(), iInventory.getScoreboardDisplayName(), iInventory.getSize())); + player.activeContainer = container; player.activeContainer.windowId = windowId; player.activeContainer.addSlotListener(player); returnValue = true; diff --git a/internal/v1_9_R2/src/main/java/com/lishid/openinv/internal/v1_9_R2/AnySilentContainer.java b/internal/v1_9_R2/src/main/java/com/lishid/openinv/internal/v1_9_R2/AnySilentContainer.java index 5adea2e..b2a5a09 100644 --- a/internal/v1_9_R2/src/main/java/com/lishid/openinv/internal/v1_9_R2/AnySilentContainer.java +++ b/internal/v1_9_R2/src/main/java/com/lishid/openinv/internal/v1_9_R2/AnySilentContainer.java @@ -28,6 +28,7 @@ import net.minecraft.server.v1_9_R2.Block; import net.minecraft.server.v1_9_R2.BlockChest; import net.minecraft.server.v1_9_R2.BlockEnderChest; import net.minecraft.server.v1_9_R2.BlockPosition; +import net.minecraft.server.v1_9_R2.Container; import net.minecraft.server.v1_9_R2.Entity; import net.minecraft.server.v1_9_R2.EntityOcelot; import net.minecraft.server.v1_9_R2.EntityPlayer; @@ -144,6 +145,7 @@ public class AnySilentContainer implements IAnySilentContainer { } Block block = world.getType(blockPosition).getBlock(); + Container container = null; if (block instanceof BlockChest) { for (EnumDirection localEnumDirection : EnumDirection.EnumDirectionLimit.HORIZONTAL) { @@ -170,26 +172,27 @@ public class AnySilentContainer implements IAnySilentContainer { } if (silentchest) { - tile = new SilentContainerChest(player.inventory, ((IInventory) tile), player); + container = new SilentContainerChest(player.inventory, ((IInventory) tile), player); } - if (((BlockChest) block).g == BlockChest.Type.BASIC) + if (((BlockChest) block).g == BlockChest.Type.BASIC) { player.b(StatisticList.ac); - else if (((BlockChest) block).g == BlockChest.Type.TRAP) { + } else if (((BlockChest) block).g == BlockChest.Type.TRAP) { player.b(StatisticList.W); } } boolean returnValue = false; - if (!silentchest) { - player.openContainer((IInventory) tile); + final IInventory iInventory = (IInventory) tile; + + if (!silentchest || container == null) { + player.openContainer(iInventory); returnValue = true; } else { try { - SilentContainerChest silentContainerChest = new SilentContainerChest(player.inventory, ((IInventory) tile), player); int windowId = player.nextContainerCounter(); - player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(windowId, "minecraft:chest", ((IInventory) tile).getScoreboardDisplayName(), ((IInventory) tile).getSize())); - player.activeContainer = silentContainerChest; + player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(windowId, iInventory.getName(), iInventory.getScoreboardDisplayName(), iInventory.getSize())); + player.activeContainer = container; player.activeContainer.windowId = windowId; player.activeContainer.addSlotListener(player); returnValue = true;