1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00
This commit is contained in:
TheBusyBiscuit 2021-05-29 10:31:38 +02:00
parent 477cad5487
commit ab2049d1d2
3 changed files with 14 additions and 4 deletions

View File

@ -49,6 +49,7 @@
* Fixed recipe types showing missing string message
* Fixed #3084
* Fixed #3085
* Fixed #3088
## Release Candidate 23 (19 May 2021)
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#23

View File

@ -14,6 +14,7 @@ import javax.annotation.ParametersAreNonnullByDefault;
import org.apache.commons.lang.Validate;
import org.bukkit.ChatColor;
import org.bukkit.Keyed;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@ -275,8 +276,14 @@ public abstract class SlimefunLocalization extends Localization implements Keyed
Validate.notNull(p, "Player cannot be null!");
Validate.notNull(recipeType, "Recipe type cannot be null!");
Language language = getLanguage(p);
ItemStack item = recipeType.toItem();
if (item == null) {
// Fixes #3088
return new ItemStack(Material.AIR);
}
Language language = getLanguage(p);
NamespacedKey key = recipeType.getKey();
return new CustomItem(item, meta -> {

View File

@ -9,6 +9,8 @@ import java.util.Locale;
import java.util.Set;
import java.util.function.BiConsumer;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import org.bukkit.ChatColor;
@ -128,11 +130,11 @@ public class RecipeType implements Keyed {
}
}
public ItemStack toItem() {
public @Nullable ItemStack toItem() {
return this.item;
}
public ItemStack getItem(Player p) {
public @Nonnull ItemStack getItem(Player p) {
return SlimefunPlugin.getLocalization().getRecipeTypeItem(p, this);
}
@ -141,7 +143,7 @@ public class RecipeType implements Keyed {
}
@Override
public final NamespacedKey getKey() {
public final @Nonnull NamespacedKey getKey() {
return key;
}