From 7278ee0293189ea3ffb44a0a1a0cb677247ee316 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Wed, 29 Jul 2020 19:40:57 +1000 Subject: [PATCH] #491: Add support to change block's lid state By: jameslfc19 --- .../src/main/java/org/bukkit/block/Barrel.java | 2 +- .../src/main/java/org/bukkit/block/Chest.java | 2 +- .../src/main/java/org/bukkit/block/Lidded.java | 16 ++++++++++++++++ .../main/java/org/bukkit/block/ShulkerBox.java | 2 +- 4 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 paper-api/src/main/java/org/bukkit/block/Lidded.java diff --git a/paper-api/src/main/java/org/bukkit/block/Barrel.java b/paper-api/src/main/java/org/bukkit/block/Barrel.java index 5eacc44ac4..aa1bb7a1a1 100644 --- a/paper-api/src/main/java/org/bukkit/block/Barrel.java +++ b/paper-api/src/main/java/org/bukkit/block/Barrel.java @@ -5,4 +5,4 @@ import org.bukkit.loot.Lootable; /** * Represents a captured state of a Barrel. */ -public interface Barrel extends Container, Lootable { } +public interface Barrel extends Container, Lootable, Lidded { } diff --git a/paper-api/src/main/java/org/bukkit/block/Chest.java b/paper-api/src/main/java/org/bukkit/block/Chest.java index c67d711010..b451191312 100644 --- a/paper-api/src/main/java/org/bukkit/block/Chest.java +++ b/paper-api/src/main/java/org/bukkit/block/Chest.java @@ -7,7 +7,7 @@ import org.jetbrains.annotations.NotNull; /** * Represents a captured state of a chest. */ -public interface Chest extends Container, Lootable { +public interface Chest extends Container, Lootable, Lidded { /** * Gets the inventory of the chest block represented by this block state. diff --git a/paper-api/src/main/java/org/bukkit/block/Lidded.java b/paper-api/src/main/java/org/bukkit/block/Lidded.java new file mode 100644 index 0000000000..9da2566e02 --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/block/Lidded.java @@ -0,0 +1,16 @@ +package org.bukkit.block; + +public interface Lidded { + + /** + * Sets the block's animated state to open and prevents it from being closed + * until {@link #close()} is called. + */ + void open(); + + /** + * Sets the block's animated state to closed even if a player is currently + * viewing this block. + */ + void close(); +} diff --git a/paper-api/src/main/java/org/bukkit/block/ShulkerBox.java b/paper-api/src/main/java/org/bukkit/block/ShulkerBox.java index 938f9aead4..2ab2660581 100644 --- a/paper-api/src/main/java/org/bukkit/block/ShulkerBox.java +++ b/paper-api/src/main/java/org/bukkit/block/ShulkerBox.java @@ -7,7 +7,7 @@ import org.jetbrains.annotations.NotNull; /** * Represents a captured state of a ShulkerBox. */ -public interface ShulkerBox extends Container, Lootable { +public interface ShulkerBox extends Container, Lootable, Lidded { /** * Get the {@link DyeColor} corresponding to this ShulkerBox