Skip to content

Instantly share code, notes, and snippets.

@frymaster
Created July 9, 2014 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frymaster/88f30faac8bd34975816 to your computer and use it in GitHub Desktop.
Save frymaster/88f30faac8bd34975816 to your computer and use it in GitHub Desktop.
--- a/src/com/martinbrook/tesseractuhc/listeners/SpectateListener.java
+++ b/src/com/martinbrook/tesseractuhc/listeners/SpectateListener.java
@@ -25,6 +25,8 @@ import org.bukkit.inventory.DoubleChestInventory;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
+import org.bukkit.block.Chest;
+import org.bukkit.block.DoubleChest;
import com.martinbrook.tesseractuhc.MatchPhase;
import com.martinbrook.tesseractuhc.UhcMatch;
@@ -128,6 +130,8 @@ public class SpectateListener implements Listener {
InventoryHolder invh = (InventoryHolder) e.getClickedBlock().getState();
Inventory inv = invh.getInventory();
+ e.setCancelled(true);
+ if (! (invh instanceof DoubleChest || invh instanceof Chest)) return;
ItemStack[] contents = inv.getContents();
for (int i = 0; i < contents.length; ++i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment