mirror of
https://github.com/TotalFreedomMC/OpenInv.git
synced 2024-12-23 00:15:08 +00:00
Add silent barrels - fixes #106
This commit is contained in:
parent
1333056613
commit
b9f901af66
1 changed files with 11 additions and 4 deletions
|
@ -21,6 +21,7 @@ import java.lang.reflect.Field;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import net.minecraft.server.v1_14_R1.AxisAlignedBB;
|
import net.minecraft.server.v1_14_R1.AxisAlignedBB;
|
||||||
import net.minecraft.server.v1_14_R1.Block;
|
import net.minecraft.server.v1_14_R1.Block;
|
||||||
|
import net.minecraft.server.v1_14_R1.BlockBarrel;
|
||||||
import net.minecraft.server.v1_14_R1.BlockChest;
|
import net.minecraft.server.v1_14_R1.BlockChest;
|
||||||
import net.minecraft.server.v1_14_R1.BlockChestTrapped;
|
import net.minecraft.server.v1_14_R1.BlockChestTrapped;
|
||||||
import net.minecraft.server.v1_14_R1.BlockEnderChest;
|
import net.minecraft.server.v1_14_R1.BlockEnderChest;
|
||||||
|
@ -78,7 +79,8 @@ public class AnySilentContainer implements IAnySilentContainer {
|
||||||
}
|
}
|
||||||
BlockState state = bukkitBlock.getState();
|
BlockState state = bukkitBlock.getState();
|
||||||
return state instanceof org.bukkit.block.Chest
|
return state instanceof org.bukkit.block.Chest
|
||||||
|| state instanceof org.bukkit.block.ShulkerBox;
|
|| state instanceof org.bukkit.block.ShulkerBox
|
||||||
|
|| state instanceof org.bukkit.block.Barrel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -258,6 +260,10 @@ public class AnySilentContainer implements IAnySilentContainer {
|
||||||
bukkitPlayer.incrementStatistic(Statistic.SHULKER_BOX_OPENED);
|
bukkitPlayer.incrementStatistic(Statistic.SHULKER_BOX_OPENED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (block instanceof BlockBarrel) {
|
||||||
|
bukkitPlayer.incrementStatistic(Statistic.OPEN_BARREL);
|
||||||
|
}
|
||||||
|
|
||||||
// AnyChest only - SilentChest not active, container unsupported, or unnecessary.
|
// AnyChest only - SilentChest not active, container unsupported, or unnecessary.
|
||||||
if (!silentchest || player.playerInteractManager.getGameMode() == EnumGamemode.SPECTATOR) {
|
if (!silentchest || player.playerInteractManager.getGameMode() == EnumGamemode.SPECTATOR) {
|
||||||
player.openContainer(tileInventory);
|
player.openContainer(tileInventory);
|
||||||
|
@ -284,9 +290,10 @@ public class AnySilentContainer implements IAnySilentContainer {
|
||||||
|
|
||||||
InventoryView view = bukkitPlayer.getOpenInventory();
|
InventoryView view = bukkitPlayer.getOpenInventory();
|
||||||
switch (view.getType()) {
|
switch (view.getType()) {
|
||||||
case CHEST:
|
case CHEST:
|
||||||
case ENDER_CHEST:
|
case ENDER_CHEST:
|
||||||
case SHULKER_BOX:
|
case SHULKER_BOX:
|
||||||
|
case BARREL:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue