From 17fcd23c77b819480d457e70924bf45b0a807620 Mon Sep 17 00:00:00 2001 From: TheMode Date: Sun, 11 Apr 2021 23:52:12 +0200 Subject: [PATCH] Fix condition, add documentation --- .../minestom/server/inventory/FillOption.java | 17 ++++++++++++++++- .../minestom/server/thread/ThreadProvider.java | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minestom/server/inventory/FillOption.java b/src/main/java/net/minestom/server/inventory/FillOption.java index 3713c5f5e..6eb74b6d2 100644 --- a/src/main/java/net/minestom/server/inventory/FillOption.java +++ b/src/main/java/net/minestom/server/inventory/FillOption.java @@ -8,11 +8,21 @@ import java.util.Map; @FunctionalInterface public interface FillOption { + /** + * Place as much as the item as possible. + *

+ * The remaining, can be air. + */ FillOption ALL = (inventory, result, itemChangesMap) -> { itemChangesMap.forEach(inventory::safeItemInsert); return result; }; + /** + * Only place the item if can be fully added. + *

+ * Returns true if the item has been added, false if nothing changed. + */ FillOption ALL_OR_NOTHING = (inventory, result, itemChangesMap) -> { if (result.isAir()) { // Item can be fully placed inside the inventory, do so @@ -24,7 +34,12 @@ public interface FillOption { } }; - FillOption DRY_RUN = (inventory, result, itemChangesMap) -> !result.isAir(); + /** + * Loop through the inventory items without changing anything. + *

+ * Returns true if the item can be fully added, false otherwise. + */ + FillOption DRY_RUN = (inventory, result, itemChangesMap) -> result.isAir(); T fill(@NotNull AbstractInventory inventory, @NotNull ItemStack result, diff --git a/src/main/java/net/minestom/server/thread/ThreadProvider.java b/src/main/java/net/minestom/server/thread/ThreadProvider.java index 937fb3237..8640736ab 100644 --- a/src/main/java/net/minestom/server/thread/ThreadProvider.java +++ b/src/main/java/net/minestom/server/thread/ThreadProvider.java @@ -38,7 +38,7 @@ public abstract class ThreadProvider { { // Default thread count in the pool (cores * 2) - setThreadCount(NettyRuntime.availableProcessors() * 2); + setThreadCount(1); } /**