diff --git a/.github/workflows/auto-squash.yml b/.github/workflows/auto-squash.yml index a310b8930..c52e88947 100644 --- a/.github/workflows/auto-squash.yml +++ b/.github/workflows/auto-squash.yml @@ -1,4 +1,4 @@ -name: Auto squash Crowdin updates +name: Auto squash pull requests on: pull_request_review: @@ -12,9 +12,9 @@ on: status: {} jobs: - autosquash: + autosquash-crowdin: - name: Auto squash + name: Auto squash (Crowdin) runs-on: ubuntu-latest ## Only run this on the main repo @@ -31,3 +31,23 @@ jobs: MERGE_DELETE_BRANCH: true MERGE_LABELS: '📄 Translations Update' MERGE_COMMIT_MESSAGE: '[CI skip] New locale updates from Crowdin' + + autosquash-renovate: + + name: Auto squash (Renovate) + runs-on: ubuntu-latest + + ## Only run this on the main repo + if: github.event.pull_request.head.repo.full_name == 'Slimefun/Slimefun4' + + steps: + - name: Auto squash + uses: pascalgn/automerge-action@v0.14.3 + env: + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} + UPDATE_RETRIES: 0 + MERGE_METHOD: squash + MERGE_FORKS: false + MERGE_DELETE_BRANCH: true + MERGE_LABELS: '🚨 Dependency Update' + MERGE_COMMIT_MESSAGE: '[CI skip] ${{ github.event.pull_request.title }}' diff --git a/CHANGELOG.md b/CHANGELOG.md index dc27b7d47..40a83931b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,6 +66,11 @@ * Fixed "LogBlock" integration * Fixed "Lands" integration * Fixed #3133 +* Fixed #3483 +* Fixed #3469 +* Fixed #3476 +* Fixed #3487 +* Fixed #3336 (again) ## Release Candidate 30 (31 Dec 2021) https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#30 diff --git a/pom.xml b/pom.xml index 7c2842ba3..cd158c0d3 100644 --- a/pom.xml +++ b/pom.xml @@ -115,7 +115,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.10.0 + 3.10.1 @@ -491,7 +491,7 @@ net.imprex orebfuscator-api - 5.2.4 + 5.2.6 provided diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItem.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItem.java index ec07e6143..9de395309 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItem.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItem.java @@ -663,7 +663,8 @@ public class SlimefunItem implements Placeable { /** * Sets the recipe for this {@link SlimefunItem}. * - * @param recipe The recipe for this {@link ItemStack} + * @param recipe + * The recipe for this {@link ItemStack} */ public void setRecipe(@Nonnull ItemStack[] recipe) { if (recipe == null || recipe.length != 9) { @@ -676,7 +677,8 @@ public class SlimefunItem implements Placeable { /** * Sets the {@link RecipeType} for this {@link SlimefunItem}. * - * @param type The {@link RecipeType} for this {@link SlimefunItem} + * @param type + * The {@link RecipeType} for this {@link SlimefunItem} */ public void setRecipeType(@Nonnull RecipeType type) { Validate.notNull(type, "The RecipeType is not allowed to be null!"); @@ -1135,7 +1137,8 @@ public class SlimefunItem implements Placeable { /** * Retrieve a {@link SlimefunItem} by its id. * - * @param id The id of the {@link SlimefunItem} + * @param id + * The id of the {@link SlimefunItem} * @return The {@link SlimefunItem} associated with that id. Null if non-existent */ public static @Nullable SlimefunItem getById(@Nonnull String id) { @@ -1145,7 +1148,8 @@ public class SlimefunItem implements Placeable { /** * Retrieve a {@link SlimefunItem} from an {@link ItemStack}. * - * @param item The {@link ItemStack} to check + * @param item + * The {@link ItemStack} to check * @return The {@link SlimefunItem} associated with this {@link ItemStack} if present, otherwise null */ public static @Nullable SlimefunItem getByItem(@Nullable ItemStack item) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/SurvivalSlimefunGuide.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/SurvivalSlimefunGuide.java index 3ff27e619..047a696a6 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/SurvivalSlimefunGuide.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/SurvivalSlimefunGuide.java @@ -33,6 +33,7 @@ import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup; import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem; import io.github.thebusybiscuit.slimefun4.api.items.groups.FlexItemGroup; import io.github.thebusybiscuit.slimefun4.api.items.groups.LockedItemGroup; +import io.github.thebusybiscuit.slimefun4.api.items.groups.SubItemGroup; import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile; import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType; import io.github.thebusybiscuit.slimefun4.api.researches.Research; @@ -360,9 +361,7 @@ public class SurvivalSlimefunGuide implements SlimefunGuideImplementation { break; } - boolean isItemGroupHidden = showHiddenItemGroupsInSearch || !slimefunItem.getItemGroup().isHidden(p); - - if (!slimefunItem.isHidden() && isItemGroupHidden && isSearchFilterApplicable(slimefunItem, searchTerm)) { + if (!slimefunItem.isHidden() && !isItemGroupHidden(p, slimefunItem) && isSearchFilterApplicable(slimefunItem, searchTerm)) { ItemStack itemstack = new CustomItemStack(slimefunItem.getItem(), meta -> { ItemGroup itemGroup = slimefunItem.getItemGroup(); meta.setLore(Arrays.asList("", ChatColor.DARK_GRAY + "\u21E8 " + ChatColor.WHITE + itemGroup.getDisplayName(p))); @@ -391,6 +390,22 @@ public class SurvivalSlimefunGuide implements SlimefunGuideImplementation { menu.open(p); } + @ParametersAreNonnullByDefault + private boolean isItemGroupHidden(Player p, SlimefunItem slimefunItem) { + if (showHiddenItemGroupsInSearch) { + return false; + } + + ItemGroup itemGroup = slimefunItem.getItemGroup(); + + // Fixes #3487 - SubItemGroups are "pseudo-hidden" + if (itemGroup instanceof SubItemGroup) { + return false; + } else { + return itemGroup.isHidden(p); + } + } + @ParametersAreNonnullByDefault private boolean isSearchFilterApplicable(SlimefunItem slimefunItem, String searchTerm) { String itemName = ChatColor.stripColor(slimefunItem.getItemName()).toLowerCase(Locale.ROOT); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/MiningTask.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/MiningTask.java index 60a15a4b7..da31690ed 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/MiningTask.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/MiningTask.java @@ -311,7 +311,12 @@ class MiningTask implements Runnable { for (MachineFuel fuelType : miner.fuelTypes) { ItemStack item = inv.getContents()[i]; - if (fuelType.test(item)) { + /* + * Fixes #3336 + * Respects the state of the miner if there are + * no errors during #setPistonState + */ + if (fuelType.test(item) && running) { ItemUtils.consumeItem(item, false); if (miner instanceof AdvancedIndustrialMiner) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java index 7c2a865a0..30071db6f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/AncientAltarListener.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.Optional; import java.util.Set; import java.util.UUID; +import java.util.Map; import javax.annotation.Nonnull; import javax.annotation.ParametersAreNonnullByDefault; @@ -115,7 +116,7 @@ public class AncientAltarListener implements Listener { return; } - // Make altarinuse simply because that was the last block clicked. + // Make altar in use simply because that was the last block clicked. altarsInUse.add(b.getLocation()); e.cancel(); @@ -156,8 +157,18 @@ public class AncientAltarListener implements Listener { Slimefun.runSync(() -> removedItems.remove(uuid), 30L); entity.remove(); - p.getInventory().addItem(pedestalItem.getOriginalItemStack(entity)); p.playSound(pedestal.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1F, 1F); + + /* + * Fixes #3476 + * Drop the item instead if the player's inventory is full and + * no stack space left else add remaining items from the returned map value + */ + Map remainingItemMap = p.getInventory().addItem(pedestalItem.getOriginalItemStack(entity)); + + for (ItemStack item : remainingItemMap.values()) { + p.getWorld().dropItem(pedestal.getLocation().add(0, 1, 0), item.clone()); + } } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/MiddleClickListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/MiddleClickListener.java index e30697a76..b35d48292 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/MiddleClickListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/MiddleClickListener.java @@ -1,7 +1,5 @@ package io.github.thebusybiscuit.slimefun4.implementation.listeners; -import java.util.Optional; - import javax.annotation.Nonnull; import javax.annotation.ParametersAreNonnullByDefault; @@ -16,10 +14,12 @@ import org.bukkit.event.inventory.InventoryType.SlotType; import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; + import me.mrCookieSlime.Slimefun.api.BlockStorage; /** - * The {@link MiddleClickListener} is responsible for listening to the {@link InventoryCreativeEvent}. + * The {@link MiddleClickListener} is responsible for listening to + * the {@link InventoryCreativeEvent}. * * @author svr333 * @@ -30,7 +30,7 @@ public class MiddleClickListener implements Listener { plugin.getServer().getPluginManager().registerEvents(this, plugin); } - /* + /* * General Discloser: this event has really really really weird behavior on middle click. * Has been tested thoroughly to make sure it doesnt break anything else. */ @@ -46,7 +46,8 @@ public class MiddleClickListener implements Listener { // get the block the player is looking at for later Block b = player.getTargetBlockExact(5); - if (!isActualMiddleClick(e, b)) { + // Fixes: #3483 + if (b == null || !isActualMiddleClick(e, b)) { return; } @@ -57,8 +58,8 @@ public class MiddleClickListener implements Listener { if (sfItem == null) { return; } - - /* + + /* * Before giving the item to the user, check if you can swap * to the item instead (user already has item in hotbar). * This is sometimes bypassed by the client itself (not fixable though). @@ -84,7 +85,7 @@ public class MiddleClickListener implements Listener { * to the actual block that is middle clicked, while currentItem will be AIR. * * This check is really weird due to the weird nature of this event's behaviour. - * It checks if the block the player is looking at is of the same type as the cursor; + * It checks if the block the player is looking at is of the same type as the cursor, * after this we can make sure that it is a middle click outside of the inventory * currentItem should also be air, otherwise it is not outside of the inventory */