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

More bug fixes

This commit is contained in:
TheBusyBiscuit 2021-02-06 01:06:11 +01:00
parent dd9a04fe04
commit 1e9e8be82a
3 changed files with 18 additions and 0 deletions

View File

@ -106,6 +106,9 @@ public abstract class AbstractAutoCrafter extends SlimefunItem implements Energy
return e -> e.getClickedBlock().ifPresent(b -> { return e -> e.getClickedBlock().ifPresent(b -> {
Player p = e.getPlayer(); Player p = e.getPlayer();
// Prevent blocks from being placed, food from being eaten, etc...
e.cancel();
if (SlimefunPlugin.getProtectionManager().hasPermission(p, b, ProtectableAction.INTERACT_BLOCK)) { if (SlimefunPlugin.getProtectionManager().hasPermission(p, b, ProtectableAction.INTERACT_BLOCK)) {
if (p.isSneaking()) { if (p.isSneaking()) {
// Select a new recipe // Select a new recipe

View File

@ -58,4 +58,9 @@ class EnhancedRecipe extends AbstractRecipe {
} }
} }
@Override
public String toString() {
return item.getId();
}
} }

View File

@ -7,6 +7,7 @@ import java.util.function.Predicate;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import org.bukkit.Keyed;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.Recipe; import org.bukkit.inventory.Recipe;
import org.bukkit.inventory.RecipeChoice; import org.bukkit.inventory.RecipeChoice;
@ -96,4 +97,13 @@ class VanillaRecipe extends AbstractRecipe {
} }
} }
@Override
public String toString() {
if (recipe instanceof Keyed) {
return ((Keyed) recipe).getKey().toString();
} else {
return "invalid-recipe";
}
}
} }