mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
Fixes #2728
This commit is contained in:
parent
e523d7849e
commit
7c929a2f22
@ -39,6 +39,7 @@
|
|||||||
* Fixed an error when the server was shutting down
|
* Fixed an error when the server was shutting down
|
||||||
* Fixed #2721
|
* Fixed #2721
|
||||||
* Fixed #2662
|
* Fixed #2662
|
||||||
|
* Fixed #2728
|
||||||
|
|
||||||
## Release Candidate 19 (11 Jan 2021)
|
## Release Candidate 19 (11 Jan 2021)
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package io.github.thebusybiscuit.slimefun4.implementation.items.magical;
|
package io.github.thebusybiscuit.slimefun4.implementation.items.magical;
|
||||||
|
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -22,6 +24,7 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
|||||||
*/
|
*/
|
||||||
public class KnowledgeFlask extends SimpleSlimefunItem<ItemUseHandler> {
|
public class KnowledgeFlask extends SimpleSlimefunItem<ItemUseHandler> {
|
||||||
|
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public KnowledgeFlask(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, ItemStack recipeOutput) {
|
public KnowledgeFlask(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, ItemStack recipeOutput) {
|
||||||
super(category, item, recipeType, recipe, recipeOutput);
|
super(category, item, recipeType, recipe, recipeOutput);
|
||||||
}
|
}
|
||||||
@ -33,7 +36,13 @@ public class KnowledgeFlask extends SimpleSlimefunItem<ItemUseHandler> {
|
|||||||
|
|
||||||
if (p.getLevel() >= 1 && (!e.getClickedBlock().isPresent() || !(e.getClickedBlock().get().getType().isInteractable()))) {
|
if (p.getLevel() >= 1 && (!e.getClickedBlock().isPresent() || !(e.getClickedBlock().get().getType().isInteractable()))) {
|
||||||
p.setLevel(p.getLevel() - 1);
|
p.setLevel(p.getLevel() - 1);
|
||||||
p.getInventory().addItem(SlimefunItems.FILLED_FLASK_OF_KNOWLEDGE.clone());
|
|
||||||
|
ItemStack item = SlimefunItems.FILLED_FLASK_OF_KNOWLEDGE.clone();
|
||||||
|
|
||||||
|
if (!p.getInventory().addItem(item).isEmpty()) {
|
||||||
|
// The Item could not be added, let's drop it to the ground (fixes #2728)
|
||||||
|
p.getWorld().dropItemNaturally(p.getLocation(), item);
|
||||||
|
}
|
||||||
|
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1F, 0.5F);
|
p.playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1F, 0.5F);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user