1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

Merge branch 'Slimefun:master' into master

This commit is contained in:
J3fftw 2022-03-14 10:36:04 +01:00 committed by GitHub
commit c71263a75c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 84 additions and 23 deletions

View File

@ -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 }}'

View File

@ -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

View File

@ -115,7 +115,7 @@
<!-- Compiler plugin -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.0</version>
<version>3.10.1</version>
<configuration>
<excludes>
@ -491,7 +491,7 @@
<dependency>
<groupId>net.imprex</groupId>
<artifactId>orebfuscator-api</artifactId>
<version>5.2.4</version>
<version>5.2.6</version>
<scope>provided</scope>
<exclusions>

View File

@ -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) {

View File

@ -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);

View File

@ -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) {

View File

@ -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<Integer, ItemStack> remainingItemMap = p.getInventory().addItem(pedestalItem.getOriginalItemStack(entity));
for (ItemStack item : remainingItemMap.values()) {
p.getWorld().dropItem(pedestal.getLocation().add(0, 1, 0), item.clone());
}
}
}

View File

@ -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
*/