mirror of
https://github.com/DieReicheErethons/Brewery.git
synced 2024-11-15 10:25:15 +01:00
Fix bug when breaking a barrel
This commit is contained in:
parent
4cd2da083c
commit
f9871d23fa
@ -1,28 +1,25 @@
|
||||
package com.dre.brewery;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.dre.brewery.integration.CitadelBarrel;
|
||||
import com.dre.brewery.integration.GriefPreventionBarrel;
|
||||
import com.dre.brewery.integration.LWCBarrel;
|
||||
import com.dre.brewery.integration.LogBlockBarrel;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
public class Barrel implements InventoryHolder {
|
||||
|
||||
@ -472,10 +469,12 @@ public class Barrel implements InventoryHolder {
|
||||
// removes a barrel, throwing included potions to the ground
|
||||
public void remove(Block broken, Player breaker) {
|
||||
if (inventory != null) {
|
||||
for (HumanEntity human : inventory.getViewers()) {
|
||||
human.closeInventory();
|
||||
while (!inventory.getViewers().isEmpty()) {
|
||||
// Use while loop to fix ConcModExc
|
||||
inventory.getViewers().get(0).closeInventory();
|
||||
}
|
||||
ItemStack[] items = inventory.getContents();
|
||||
inventory.clear();
|
||||
if (P.p.useLB && breaker != null) {
|
||||
try {
|
||||
LogBlockBarrel.breakBarrel(breaker, items, spigot.getLocation());
|
||||
|
Loading…
Reference in New Issue
Block a user