1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00

[CI skip] You can no longer /sf give yourself a Multiblock

This commit is contained in:
TheBusyBiscuit 2020-04-14 23:50:12 +02:00
parent b0e8719696
commit 76b8204bd0
3 changed files with 18 additions and 8 deletions

View File

@ -67,6 +67,7 @@
* Slimefun Guide runs much faster now and can better deal with many Categories and items
* Lots of API improvements
* Faulty addons are now identified more easily and will no longer break Slimefun's main content this quickly
* You can no longer /sf give yourself a Multiblock
#### Fixes
* Fixed error message when clicking empty slots in the Slimefun Guide

View File

@ -12,6 +12,7 @@ import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.MultiBlockMachine;
class GiveCommand extends SubCommand {
@ -44,14 +45,21 @@ class GiveCommand extends SubCommand {
SlimefunItem sfItem = SlimefunItem.getByID(args[2].toUpperCase(Locale.ROOT));
if (sfItem != null) {
int amount = parseAmount(args);
if (amount > 0) {
SlimefunPlugin.getLocal().sendMessage(p, "messages.given-item", true, msg -> msg.replace(PLACEHOLDER_ITEM, sfItem.getItemName()).replace(PLACEHOLDER_AMOUNT, String.valueOf(amount)));
p.getInventory().addItem(new CustomItem(sfItem.getItem(), amount));
SlimefunPlugin.getLocal().sendMessage(sender, "messages.give-item", true, msg -> msg.replace(PLACEHOLDER_PLAYER, args[1]).replace(PLACEHOLDER_ITEM, sfItem.getItemName()).replace(PLACEHOLDER_AMOUNT, String.valueOf(amount)));
if (sfItem instanceof MultiBlockMachine) {
SlimefunPlugin.getLocal().sendMessage(sender, "guide.cheat.no-multiblocks");
}
else {
int amount = parseAmount(args);
if (amount > 0) {
SlimefunPlugin.getLocal().sendMessage(p, "messages.given-item", true, msg -> msg.replace(PLACEHOLDER_ITEM, sfItem.getItemName()).replace(PLACEHOLDER_AMOUNT, String.valueOf(amount)));
p.getInventory().addItem(new CustomItem(sfItem.getItem(), amount));
SlimefunPlugin.getLocal().sendMessage(sender, "messages.give-item", true, msg -> msg.replace(PLACEHOLDER_PLAYER, args[1]).replace(PLACEHOLDER_ITEM, sfItem.getItemName()).replace(PLACEHOLDER_AMOUNT, String.valueOf(amount)));
}
else {
SlimefunPlugin.getLocal().sendMessage(sender, "messages.not-valid-amount", true, msg -> msg.replace(PLACEHOLDER_AMOUNT, args[3]));
}
}
else SlimefunPlugin.getLocal().sendMessage(sender, "messages.not-valid-amount", true, msg -> msg.replace(PLACEHOLDER_AMOUNT, args[3]));
}
else SlimefunPlugin.getLocal().sendMessage(sender, "messages.not-valid-item", true, msg -> msg.replace(PLACEHOLDER_ITEM, args[2]));
}

View File

@ -18,6 +18,7 @@ import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunMachine;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.NotPlaceable;
import me.mrCookieSlime.Slimefun.Objects.handlers.MultiBlockInteractionHandler;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.Slimefun;
@ -32,7 +33,7 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
* @see MultiBlock
*
*/
public abstract class MultiBlockMachine extends SlimefunMachine {
public abstract class MultiBlockMachine extends SlimefunMachine implements NotPlaceable {
private static final BlockFace[] outputFaces = { BlockFace.UP, BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST };