mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Fixed #3487
This commit is contained in:
parent
c88b43717c
commit
cea7204994
@ -67,6 +67,9 @@
|
|||||||
* Fixed "Lands" integration
|
* Fixed "Lands" integration
|
||||||
* Fixed #3133
|
* Fixed #3133
|
||||||
* Fixed #3483
|
* Fixed #3483
|
||||||
|
* Fixed #3469
|
||||||
|
* Fixed #3476
|
||||||
|
* Fixed #3487
|
||||||
|
|
||||||
## Release Candidate 30 (31 Dec 2021)
|
## Release Candidate 30 (31 Dec 2021)
|
||||||
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#30
|
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#30
|
||||||
|
@ -663,7 +663,8 @@ public class SlimefunItem implements Placeable {
|
|||||||
/**
|
/**
|
||||||
* Sets the recipe for this {@link SlimefunItem}.
|
* 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) {
|
public void setRecipe(@Nonnull ItemStack[] recipe) {
|
||||||
if (recipe == null || recipe.length != 9) {
|
if (recipe == null || recipe.length != 9) {
|
||||||
@ -676,7 +677,8 @@ public class SlimefunItem implements Placeable {
|
|||||||
/**
|
/**
|
||||||
* Sets the {@link RecipeType} for this {@link SlimefunItem}.
|
* 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) {
|
public void setRecipeType(@Nonnull RecipeType type) {
|
||||||
Validate.notNull(type, "The RecipeType is not allowed to be null!");
|
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.
|
* 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
|
* @return The {@link SlimefunItem} associated with that id. Null if non-existent
|
||||||
*/
|
*/
|
||||||
public static @Nullable SlimefunItem getById(@Nonnull String id) {
|
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}.
|
* 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
|
* @return The {@link SlimefunItem} associated with this {@link ItemStack} if present, otherwise null
|
||||||
*/
|
*/
|
||||||
public static @Nullable SlimefunItem getByItem(@Nullable ItemStack item) {
|
public static @Nullable SlimefunItem getByItem(@Nullable ItemStack item) {
|
||||||
|
@ -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.SlimefunItem;
|
||||||
import io.github.thebusybiscuit.slimefun4.api.items.groups.FlexItemGroup;
|
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.LockedItemGroup;
|
||||||
|
import io.github.thebusybiscuit.slimefun4.api.items.groups.SubItemGroup;
|
||||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||||
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
|
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
|
||||||
import io.github.thebusybiscuit.slimefun4.api.researches.Research;
|
import io.github.thebusybiscuit.slimefun4.api.researches.Research;
|
||||||
@ -360,9 +361,7 @@ public class SurvivalSlimefunGuide implements SlimefunGuideImplementation {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isItemGroupHidden = showHiddenItemGroupsInSearch || !slimefunItem.getItemGroup().isHidden(p);
|
if (!slimefunItem.isHidden() && !isItemGroupHidden(p, slimefunItem) && isSearchFilterApplicable(slimefunItem, searchTerm)) {
|
||||||
|
|
||||||
if (!slimefunItem.isHidden() && isItemGroupHidden && isSearchFilterApplicable(slimefunItem, searchTerm)) {
|
|
||||||
ItemStack itemstack = new CustomItemStack(slimefunItem.getItem(), meta -> {
|
ItemStack itemstack = new CustomItemStack(slimefunItem.getItem(), meta -> {
|
||||||
ItemGroup itemGroup = slimefunItem.getItemGroup();
|
ItemGroup itemGroup = slimefunItem.getItemGroup();
|
||||||
meta.setLore(Arrays.asList("", ChatColor.DARK_GRAY + "\u21E8 " + ChatColor.WHITE + itemGroup.getDisplayName(p)));
|
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);
|
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
|
@ParametersAreNonnullByDefault
|
||||||
private boolean isSearchFilterApplicable(SlimefunItem slimefunItem, String searchTerm) {
|
private boolean isSearchFilterApplicable(SlimefunItem slimefunItem, String searchTerm) {
|
||||||
String itemName = ChatColor.stripColor(slimefunItem.getItemName()).toLowerCase(Locale.ROOT);
|
String itemName = ChatColor.stripColor(slimefunItem.getItemName()).toLowerCase(Locale.ROOT);
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package io.github.thebusybiscuit.slimefun4.implementation.listeners;
|
package io.github.thebusybiscuit.slimefun4.implementation.listeners;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
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.api.items.SlimefunItem;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
|
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
|
||||||
|
|
||||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
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
|
* @author svr333
|
||||||
*
|
*
|
||||||
@ -85,7 +85,7 @@ public class MiddleClickListener implements Listener {
|
|||||||
* to the actual block that is middle clicked, while currentItem will be AIR.
|
* 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.
|
* 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
|
* 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
|
* currentItem should also be air, otherwise it is not outside of the inventory
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user