Fix SPIGOT-2806 for silent chests, various other issues

* Fixed anychest message spam
* Changed AnySilentContainer again to reduce duplicate checks
 * #isAnyContainerNeeded should be checked before calling #activateContainer
 * reorganized ifs for doublechest creation into reverse-order if elses to prevent creating extras when someone's broken Minecraft and put 3+ adjacent to each other
* Fixed incorrect block being checked for anychest in 1.11
* Progress on SilentContainerShulkerBox (we're getting there!)

anychest and silentchest aren't quite at 100% after all these changes, but it won't be a priority to revisit logic until shulker boxes are done
This commit is contained in:
Jikoo
2016-11-22 03:30:34 -05:00
parent 476171911a
commit 454467c20e
42 changed files with 407 additions and 370 deletions

View File

@@ -1,6 +1,6 @@
package com.lishid.openinv.internal;
import org.bukkit.block.BlockState;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
public interface IAnySilentContainer extends IAnySilentChest {
@@ -11,20 +11,21 @@ public interface IAnySilentContainer extends IAnySilentChest {
* @param block the BlockState
* @return true if the Block is a supported container
*/
public boolean isAnySilentContainer(BlockState block);
public boolean isAnySilentContainer(Block block);
/**
* Opens the container at the given coordinates for the Player.
* Opens the container at the given coordinates for the Player. If you do not want blocked
* containers to open, be sure to check {@link #isAnyContainerNeeded(Player, int, int, int)}
* first.
*
* @param player
* @param anychest whether compatibility for blocked containers is to be used
* @param silentchest whether the container's noise is to be silenced
* @param x the x coordinate
* @param y the y coordinate
* @param z the z coordinate
* @return true if the container can be opened
*/
public boolean activateContainer(Player player, boolean anychest, boolean silentchest, int x, int y, int z);
public boolean activateContainer(Player player, boolean silentchest, int x, int y, int z);
/**
* Checks if the container at the given coordinates is blocked.