From 72bd02b83350bbfb933a05d79584559a299448e1 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sat, 15 Jan 2022 16:55:12 +0100 Subject: [PATCH 01/34] Removed ChestTerminal support --- .../networks/cargo/AbstractItemNetwork.java | 355 +----------------- .../core/networks/cargo/CargoNet.java | 45 +-- .../core/networks/cargo/CargoNetworkTask.java | 19 +- .../core/networks/cargo/ItemRequest.java | 55 --- .../items/cargo/AbstractCargoNode.java | 13 +- .../integrations/IntegrationsManager.java | 26 -- 6 files changed, 15 insertions(+), 498 deletions(-) delete mode 100644 src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/ItemRequest.java diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/AbstractItemNetwork.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/AbstractItemNetwork.java index 82666eacb5..2cce2bb796 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/AbstractItemNetwork.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/AbstractItemNetwork.java @@ -1,17 +1,9 @@ package io.github.thebusybiscuit.slimefun4.core.networks.cargo; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.Queue; -import java.util.Set; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -21,29 +13,15 @@ import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.block.BlockState; import org.bukkit.block.data.BlockData; import org.bukkit.block.data.Directional; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import io.github.bakedlibs.dough.common.ChatColors; -import io.github.bakedlibs.dough.items.CustomItemStack; -import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem; import io.github.thebusybiscuit.slimefun4.api.network.Network; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; -import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils; -import io.github.thebusybiscuit.slimefun4.utils.NumberUtils; import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; -import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper; -import io.papermc.lib.PaperLib; -import me.mrCookieSlime.Slimefun.api.BlockStorage; -import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu; import me.mrCookieSlime.Slimefun.api.inventory.DirtyChestMenu; -import me.mrCookieSlime.Slimefun.api.inventory.UniversalBlockMenu; import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow; /** @@ -55,21 +33,6 @@ */ abstract class AbstractItemNetwork extends Network { - private static final int[] slots = { 19, 20, 21, 28, 29, 30, 37, 38, 39 }; - private static final int[] TERMINAL_SLOTS = { 0, 1, 2, 3, 4, 5, 6, 9, 10, 11, 12, 13, 14, 15, 18, 19, 20, 21, 22, 23, 24, 27, 28, 29, 30, 31, 32, 33, 36, 37, 38, 39, 40, 41, 42 }; - private static final int TERMINAL_OUT_SLOT = 17; - - private final ItemStack terminalPlaceholderItem = new CustomItemStack(Material.BARRIER, "&4No Item cached"); - - protected final Set terminals = new HashSet<>(); - protected final Set imports = new HashSet<>(); - protected final Set exports = new HashSet<>(); - - /** - * This represents a {@link Queue} of requests to handle - */ - private final Queue itemRequests = new LinkedList<>(); - /** * This is a cache for the {@link BlockFace} a node is facing, so we don't need to * request the {@link BlockData} each time we visit a node @@ -81,11 +44,11 @@ abstract class AbstractItemNetwork extends Network { */ protected Map filterCache = new HashMap<>(); - protected AbstractItemNetwork(Location regulator) { + protected AbstractItemNetwork(@Nonnull Location regulator) { super(Slimefun.getNetworkManager(), regulator); } - protected Optional getAttachedBlock(Location l) { + protected Optional getAttachedBlock(@Nonnull Location l) { if (l.getWorld().isChunkLoaded(l.getBlockX() >> 4, l.getBlockZ() >> 4)) { Block block = l.getBlock(); @@ -105,235 +68,6 @@ protected Optional getAttachedBlock(Location l) { return Optional.empty(); } - protected void handleItemRequests(Map inventories, Set providers, Set destinations) { - collectImportRequests(inventories); - collectExportRequests(inventories); - collectTerminalRequests(); - - Iterator iterator = itemRequests.iterator(); - while (iterator.hasNext()) { - ItemRequest request = iterator.next(); - BlockMenu menu = BlockStorage.getInventory(request.getTerminal()); - - if (menu != null) { - switch (request.getDirection()) { - case INSERT: - distributeInsertionRequest(inventories, request, menu, iterator, destinations); - break; - case WITHDRAW: - collectExtractionRequest(inventories, request, menu, iterator, providers); - break; - default: - break; - } - } - } - } - - private void distributeInsertionRequest(Map inventories, ItemRequest request, BlockMenu terminal, Iterator iterator, Set destinations) { - ItemStack item = request.getItem(); - - for (Location l : destinations) { - Optional target = getAttachedBlock(l); - - if (target.isPresent()) { - item = CargoUtils.insert(this, inventories, l.getBlock(), target.get(), false, item, ItemStackWrapper.wrap(item)); - - if (item == null) { - terminal.replaceExistingItem(request.getSlot(), null); - break; - } - } - } - - if (item != null) { - terminal.replaceExistingItem(request.getSlot(), item); - } - - iterator.remove(); - } - - private void collectExtractionRequest(Map inventories, ItemRequest request, BlockMenu terminal, Iterator iterator, Set providers) { - int slot = request.getSlot(); - ItemStack prevStack = terminal.getItemInSlot(slot); - - if (!(prevStack == null || (prevStack.getAmount() + request.getItem().getAmount() <= prevStack.getMaxStackSize() && SlimefunUtils.isItemSimilar(prevStack, request.getItem(), true, false)))) { - iterator.remove(); - return; - } - - ItemStack stack = null; - ItemStack item = request.getItem(); - - for (Location l : providers) { - Optional target = getAttachedBlock(l); - - if (target.isPresent()) { - ItemStack is = CargoUtils.withdraw(this, inventories, l.getBlock(), target.get(), item); - - if (is != null) { - if (stack == null) { - stack = is; - } else { - stack = new CustomItemStack(stack, stack.getAmount() + is.getAmount()); - } - - if (is.getAmount() == item.getAmount()) { - break; - } else { - item = new CustomItemStack(item, item.getAmount() - is.getAmount()); - } - } - } - } - - if (stack != null) { - ItemStack prev = terminal.getItemInSlot(slot); - - if (prev == null) { - terminal.replaceExistingItem(slot, stack); - } else { - terminal.replaceExistingItem(slot, new CustomItemStack(stack, stack.getAmount() + prev.getAmount())); - } - } - - iterator.remove(); - } - - private void collectImportRequests(Map inventories) { - SlimefunItem item = SlimefunItem.getById("CT_IMPORT_BUS"); - - for (Location bus : imports) { - long timestamp = Slimefun.getProfiler().newEntry(); - BlockMenu menu = BlockStorage.getInventory(bus); - - if (menu.getItemInSlot(17) == null) { - Optional target = getAttachedBlock(bus); - - if (target.isPresent()) { - ItemStackAndInteger stack = CargoUtils.withdraw(this, inventories, bus.getBlock(), target.get()); - - if (stack != null) { - menu.replaceExistingItem(17, stack.getItem()); - } - } - } - - if (menu.getItemInSlot(17) != null) { - itemRequests.add(new ItemRequest(bus, 17, menu.getItemInSlot(17), ItemTransportFlow.INSERT)); - } - - Slimefun.getProfiler().closeEntry(bus, item, timestamp); - } - } - - private void collectExportRequests(Map inventories) { - SlimefunItem item = SlimefunItem.getById("CT_EXPORT_BUS"); - - for (Location bus : exports) { - long timestamp = Slimefun.getProfiler().newEntry(); - BlockMenu menu = BlockStorage.getInventory(bus); - - ItemStack itemSlot17 = menu.getItemInSlot(17); - if (itemSlot17 != null) { - Optional target = getAttachedBlock(bus); - target.ifPresent(block -> menu.replaceExistingItem(17, CargoUtils.insert(this, inventories, bus.getBlock(), block, false, itemSlot17, ItemStackWrapper.wrap(itemSlot17)))); - } - - if (menu.getItemInSlot(17) == null) { - List items = new ArrayList<>(); - - for (int slot : slots) { - ItemStack template = menu.getItemInSlot(slot); - - if (template != null) { - items.add(new CustomItemStack(template, 1)); - } - } - - if (!items.isEmpty()) { - int index = Integer.parseInt(BlockStorage.getLocationInfo(bus, "index")); - - index++; - if (index > (items.size() - 1)) { - index = 0; - } - - BlockStorage.addBlockInfo(bus, "index", String.valueOf(index)); - itemRequests.add(new ItemRequest(bus, 17, items.get(index), ItemTransportFlow.WITHDRAW)); - } - } - - Slimefun.getProfiler().closeEntry(bus, item, timestamp); - } - } - - private void collectTerminalRequests() { - for (Location terminal : terminals) { - BlockMenu menu = BlockStorage.getInventory(terminal); - ItemStack sendingItem = menu.getItemInSlot(TERMINAL_OUT_SLOT); - - if (sendingItem != null) { - itemRequests.add(new ItemRequest(terminal, TERMINAL_OUT_SLOT, sendingItem, ItemTransportFlow.INSERT)); - } - } - } - - /** - * This method updates every terminal on the network with {@link ItemStack ItemStacks} - * found in any provider of the network. - * - * @param providers - * A {@link Set} of providers to this {@link AbstractItemNetwork} - * - * @return The time it took to compute this operation - */ - protected long updateTerminals(@Nonnull Set providers) { - if (terminals.isEmpty()) { - // Performance improvement - We don't need to compute items for - // Cargo networks without any Chest Terminals - return 0; - } - - // Timings will be slightly inaccurate here but most often people are not - // gonna use no more than one terminal anyway, so this might be fine - long timestamp = System.nanoTime(); - Location firstTerminal = null; - SlimefunItem item = SlimefunItem.getById("CHEST_TERMINAL"); - List items = findAvailableItems(providers); - - try { - for (Location l : terminals) { - BlockMenu terminal = BlockStorage.getInventory(l); - String data = BlockStorage.getLocationInfo(l, "page"); - int page = data == null ? 1 : Integer.parseInt(data); - - if (!items.isEmpty() && items.size() < (page - 1) * TERMINAL_SLOTS.length + 1) { - page = 1; - BlockStorage.addBlockInfo(l, "page", String.valueOf(1)); - } - - for (int i = 0; i < TERMINAL_SLOTS.length; i++) { - int slot = TERMINAL_SLOTS[i]; - int index = i + (TERMINAL_SLOTS.length * (page - 1)); - updateTerminal(l, terminal, slot, index, items); - } - - if (firstTerminal == null) { - firstTerminal = l; - } - } - } catch (Exception | LinkageError x) { - item.error("An Exception was caused while trying to tick Chest terminals", x); - } - - if (firstTerminal != null) { - return Slimefun.getProfiler().closeEntry(firstTerminal, item, timestamp); - } else { - return System.nanoTime() - timestamp; - } - } - @Override public void markDirty(@Nonnull Location l) { markCargoNodeConfigurationDirty(l); @@ -357,88 +91,6 @@ public void markCargoNodeConfigurationDirty(@Nonnull Location node) { connectorCache.remove(node); } - @ParametersAreNonnullByDefault - private void updateTerminal(Location l, BlockMenu terminal, int slot, int index, List items) { - if (items.size() > index) { - ItemStackAndInteger item = items.get(index); - - ItemStack stack = item.getItem().clone(); - stack.setAmount(1); - ItemMeta im = stack.getItemMeta(); - List lore = new ArrayList<>(); - lore.add(""); - lore.add(ChatColors.color("&7Stored Items: &f" + NumberUtils.getCompactDouble(item.getInt()))); - - if (stack.getMaxStackSize() > 1) { - int amount = item.getInt() > stack.getMaxStackSize() ? stack.getMaxStackSize() : item.getInt(); - lore.add(ChatColors.color("&7")); - } else { - lore.add(ChatColors.color("&7")); - } - - lore.add(""); - - if (im.hasLore()) { - lore.addAll(im.getLore()); - } - - im.setLore(lore); - stack.setItemMeta(im); - terminal.replaceExistingItem(slot, stack); - terminal.addMenuClickHandler(slot, (p, sl, is, action) -> { - int amount = item.getInt() > item.getItem().getMaxStackSize() ? item.getItem().getMaxStackSize() : item.getInt(); - ItemStack requestedItem = new CustomItemStack(item.getItem(), action.isRightClicked() ? amount : 1); - itemRequests.add(new ItemRequest(l, 44, requestedItem, ItemTransportFlow.WITHDRAW)); - return false; - }); - - } else { - terminal.replaceExistingItem(slot, terminalPlaceholderItem); - terminal.addMenuClickHandler(slot, ChestMenuUtils.getEmptyClickHandler()); - } - } - - @Nonnull - private List findAvailableItems(@Nonnull Set providers) { - List items = new LinkedList<>(); - - for (Location l : providers) { - Optional block = getAttachedBlock(l); - - if (block.isPresent()) { - findAllItems(items, l, block.get()); - } - } - - Collections.sort(items, Comparator.comparingInt(item -> -item.getInt())); - return items; - } - - @ParametersAreNonnullByDefault - private void findAllItems(List items, Location l, Block target) { - UniversalBlockMenu menu = BlockStorage.getUniversalInventory(target); - - if (menu != null) { - for (int slot : menu.getPreset().getSlotsAccessedByItemTransport(menu, ItemTransportFlow.WITHDRAW, null)) { - ItemStack is = menu.getItemInSlot(slot); - filter(is, items, l); - } - } else if (BlockStorage.hasInventory(target)) { - BlockMenu blockMenu = BlockStorage.getInventory(target); - handleWithdraw(blockMenu, items, l); - } else if (CargoUtils.hasInventory(target)) { - BlockState state = PaperLib.getBlockState(target, false).getState(); - - if (state instanceof InventoryHolder) { - Inventory inv = ((InventoryHolder) state).getInventory(); - - for (ItemStack is : inv.getContents()) { - filter(is, items, l); - } - } - } - } - @ParametersAreNonnullByDefault private void handleWithdraw(DirtyChestMenu menu, List items, Location l) { for (int slot : menu.getPreset().getSlotsAccessedByItemTransport(menu, ItemTransportFlow.WITHDRAW, null)) { @@ -464,8 +116,7 @@ private void filter(@Nullable ItemStack stack, List items, } } - @Nonnull - protected ItemFilter getItemFilter(@Nonnull Block node) { + protected @Nonnull ItemFilter getItemFilter(@Nonnull Block node) { Location loc = node.getLocation(); ItemFilter filter = filterCache.get(loc); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoNet.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoNet.java index 29b87c18b3..ea096a2e74 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoNet.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoNet.java @@ -50,13 +50,11 @@ public class CargoNet extends AbstractItemNetwork implements HologramOwner { protected final Map roundRobin = new HashMap<>(); private int tickDelayThreshold = 0; - @Nullable - public static CargoNet getNetworkFromLocation(@Nonnull Location l) { + public static @Nullable CargoNet getNetworkFromLocation(@Nonnull Location l) { return Slimefun.getNetworkManager().getNetworkFromLocation(l, CargoNet.class).orElse(null); } - @Nonnull - public static CargoNet getNetworkFromLocationOrCreate(@Nonnull Location l) { + public static @Nonnull CargoNet getNetworkFromLocationOrCreate(@Nonnull Location l) { Optional cargoNetwork = Slimefun.getNetworkManager().getNetworkFromLocation(l, CargoNet.class); if (cargoNetwork.isPresent()) { @@ -120,9 +118,6 @@ public void onClassificationChange(Location l, NetworkComponent from, NetworkCom if (from == NetworkComponent.TERMINUS) { inputNodes.remove(l); outputNodes.remove(l); - terminals.remove(l); - imports.remove(l); - exports.remove(l); } if (to == NetworkComponent.TERMINUS) { @@ -135,15 +130,6 @@ public void onClassificationChange(Location l, NetworkComponent from, NetworkCom case "CARGO_NODE_OUTPUT_ADVANCED": outputNodes.add(l); break; - case "CHEST_TERMINAL": - terminals.add(l); - break; - case "CT_IMPORT_BUS": - imports.add(l); - break; - case "CT_EXPORT_BUS": - exports.add(l); - break; default: break; } @@ -173,34 +159,27 @@ public void tick(@Nonnull Block b) { // Reset the internal threshold, so we can start skipping again tickDelayThreshold = 0; - // Chest Terminal Stuff - Set chestTerminalInputs = new HashSet<>(); - Set chestTerminalOutputs = new HashSet<>(); - - Map inputs = mapInputNodes(chestTerminalInputs); - Map> outputs = mapOutputNodes(chestTerminalOutputs); + Map inputs = mapInputNodes(); + Map> outputs = mapOutputNodes(); if (BlockStorage.getLocationInfo(b.getLocation(), "visualizer") == null) { display(); } - Slimefun.getProfiler().scheduleEntries((terminals.isEmpty() ? 1 : 2) + inputs.size()); + Slimefun.getProfiler().scheduleEntries(inputs.size() + 1); - CargoNetworkTask runnable = new CargoNetworkTask(this, inputs, outputs, chestTerminalInputs, chestTerminalOutputs); + CargoNetworkTask runnable = new CargoNetworkTask(this, inputs, outputs); Slimefun.runSync(runnable); } } - @Nonnull - private Map mapInputNodes(@Nonnull Set chestTerminalNodes) { + private @Nonnull Map mapInputNodes() { Map inputs = new HashMap<>(); for (Location node : inputNodes) { int frequency = getFrequency(node); - if (frequency == 16) { - chestTerminalNodes.add(node); - } else if (frequency >= 0 && frequency < 16) { + if (frequency >= 0 && frequency < 16) { inputs.put(node, frequency); } } @@ -208,8 +187,7 @@ private Map mapInputNodes(@Nonnull Set chestTermina return inputs; } - @Nonnull - private Map> mapOutputNodes(@Nonnull Set chestTerminalOutputs) { + private @Nonnull Map> mapOutputNodes() { Map> output = new HashMap<>(); List list = new LinkedList<>(); @@ -218,11 +196,6 @@ private Map> mapOutputNodes(@Nonnull Set chest for (Location node : outputNodes) { int frequency = getFrequency(node); - if (frequency == 16) { - chestTerminalOutputs.add(node); - continue; - } - if (frequency != lastFrequency && lastFrequency != -1) { output.merge(lastFrequency, list, (prev, next) -> { prev.addAll(next); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoNetworkTask.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoNetworkTask.java index edece7dcbd..84185e479a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoNetworkTask.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoNetworkTask.java @@ -9,7 +9,6 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; -import java.util.Set; import java.util.logging.Level; import javax.annotation.Nullable; @@ -55,18 +54,13 @@ class CargoNetworkTask implements Runnable { private final Map inputs; private final Map> outputs; - private final Set chestTerminalInputs; - private final Set chestTerminalOutputs; - @ParametersAreNonnullByDefault - CargoNetworkTask(CargoNet network, Map inputs, Map> outputs, Set chestTerminalInputs, Set chestTerminalOutputs) { + CargoNetworkTask(CargoNet network, Map inputs, Map> outputs) { this.network = network; this.manager = Slimefun.getNetworkManager(); this.inputs = inputs; this.outputs = outputs; - this.chestTerminalInputs = chestTerminalInputs; - this.chestTerminalOutputs = chestTerminalOutputs; } @Override @@ -74,11 +68,6 @@ public void run() { long timestamp = System.nanoTime(); try { - // Chest Terminal Code - if (Slimefun.getIntegrations().isChestTerminalInstalled()) { - network.handleItemRequests(inventories, chestTerminalInputs, chestTerminalOutputs); - } - /** * All operations happen here: Everything gets iterated from the Input Nodes. * (Apart from ChestTerminal Buses) @@ -94,12 +83,6 @@ public void run() { // This will prevent this timings from showing up for the Cargo Manager timestamp += Slimefun.getProfiler().closeEntry(entry.getKey(), inputNode, nodeTimestamp); } - - // Chest Terminal Code - if (Slimefun.getIntegrations().isChestTerminalInstalled()) { - // This will deduct any CT timings and attribute them towards the actual terminal - timestamp += network.updateTerminals(chestTerminalInputs); - } } catch (Exception | LinkageError x) { Slimefun.logger().log(Level.SEVERE, x, () -> "An Exception was caught while ticking a Cargo network @ " + new BlockPosition(network.getRegulator())); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/ItemRequest.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/ItemRequest.java deleted file mode 100644 index 2e015f5ba7..0000000000 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/ItemRequest.java +++ /dev/null @@ -1,55 +0,0 @@ -package io.github.thebusybiscuit.slimefun4.core.networks.cargo; - -import java.util.Objects; - -import org.bukkit.Location; -import org.bukkit.inventory.ItemStack; - -import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow; - -class ItemRequest { - - private final ItemStack item; - private final ItemTransportFlow flow; - private final Location terminal; - private final int slot; - - ItemRequest(Location terminal, int slot, ItemStack item, ItemTransportFlow flow) { - this.terminal = terminal; - this.item = item; - this.slot = slot; - this.flow = flow; - } - - public Location getTerminal() { - return terminal; - } - - public ItemStack getItem() { - return item; - } - - public ItemTransportFlow getDirection() { - return flow; - } - - public int getSlot() { - return slot; - } - - @Override - public int hashCode() { - return Objects.hash(item, slot, flow, terminal); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof ItemRequest) { - ItemRequest request = (ItemRequest) obj; - return Objects.equals(item, request.item) && Objects.equals(terminal, request.terminal) && slot == request.slot && flow == request.flow; - } else { - return false; - } - } - -} diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/cargo/AbstractCargoNode.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/cargo/AbstractCargoNode.java index c3de2cbc5e..b662a060c1 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/cargo/AbstractCargoNode.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/cargo/AbstractCargoNode.java @@ -89,7 +89,6 @@ public void onPlayerPlace(BlockPlaceEvent e) { @ParametersAreNonnullByDefault protected void addChannelSelector(Block b, BlockMenu menu, int slotPrev, int slotCurrent, int slotNext) { - boolean isChestTerminalInstalled = Slimefun.getIntegrations().isChestTerminalInstalled(); int channel = getSelectedChannel(b); menu.replaceExistingItem(slotPrev, new CustomItemStack(HeadTexture.CARGO_ARROW_LEFT.getAsItemStack(), "&bPrevious Channel", "", "&e> Click to decrease the Channel ID by 1")); @@ -97,11 +96,7 @@ protected void addChannelSelector(Block b, BlockMenu menu, int slotPrev, int slo int newChannel = channel - 1; if (newChannel < 0) { - if (isChestTerminalInstalled) { - newChannel = 16; - } else { - newChannel = 15; - } + newChannel = 15; } BlockStorage.addBlockInfo(b, FREQUENCY, String.valueOf(newChannel)); @@ -121,11 +116,7 @@ protected void addChannelSelector(Block b, BlockMenu menu, int slotPrev, int slo menu.addMenuClickHandler(slotNext, (p, slot, item, action) -> { int newChannel = channel + 1; - if (isChestTerminalInstalled) { - if (newChannel > 16) { - newChannel = 0; - } - } else if (newChannel > 15) { + if (newChannel > 15) { newChannel = 0; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/IntegrationsManager.java b/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/IntegrationsManager.java index 501fe851b2..4ac1c21365 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/IntegrationsManager.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/IntegrationsManager.java @@ -60,9 +60,6 @@ public class IntegrationsManager { private boolean isItemsAdderInstalled = false; private boolean isOrebfuscatorInstalled = false; - // Addon support - private boolean isChestTerminalInstalled = false; - /** * This initializes the {@link IntegrationsManager} * @@ -150,25 +147,6 @@ private void onServerStart() { new OrebfuscatorIntegration(plugin).register(); isOrebfuscatorInstalled = true; }); - - isChestTerminalInstalled = isAddonInstalled("ChestTerminal"); - } - - /** - * This method checks if the given addon is installed. - * - * @param addon - * The name of the addon - * - * @return Whether that addon is installed on the {@link Server} - */ - private boolean isAddonInstalled(@Nonnull String addon) { - if (plugin.getServer().getPluginManager().isPluginEnabled(addon)) { - Slimefun.logger().log(Level.INFO, "Hooked into Slimefun Addon: {0}", addon); - return true; - } else { - return false; - } } /** @@ -328,10 +306,6 @@ public boolean isItemsAdderInstalled() { return isItemsAdderInstalled; } - public boolean isChestTerminalInstalled() { - return isChestTerminalInstalled; - } - public boolean isOrebfuscatorInstalled() { return isOrebfuscatorInstalled; } From c4317a23a0d66968b708fd798e74d8844cf5d5c1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 12 Apr 2022 09:52:07 +0200 Subject: [PATCH 02/34] [CI skip] Update actions/setup-java action to v3.1.1 --- .github/workflows/discord-webhook.yml | 2 +- .github/workflows/maven-compiler.yml | 2 +- .github/workflows/sonarcloud.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/discord-webhook.yml b/.github/workflows/discord-webhook.yml index fc69172066..47de6d6c16 100644 --- a/.github/workflows/discord-webhook.yml +++ b/.github/workflows/discord-webhook.yml @@ -21,7 +21,7 @@ jobs: uses: actions/checkout@v3.0.0 - name: Set up Java JDK 17 - uses: actions/setup-java@v3.1.0 + uses: actions/setup-java@v3.1.1 with: distribution: 'adopt' java-version: '17' diff --git a/.github/workflows/maven-compiler.yml b/.github/workflows/maven-compiler.yml index 919f8fcd5a..a5743d9798 100644 --- a/.github/workflows/maven-compiler.yml +++ b/.github/workflows/maven-compiler.yml @@ -24,7 +24,7 @@ jobs: uses: actions/checkout@v3 - name: Set up JDK 17 - uses: actions/setup-java@v3.1.0 + uses: actions/setup-java@v3.1.1 with: distribution: 'adopt' java-version: '17' diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 2f89546527..b8486bc107 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -21,7 +21,7 @@ jobs: fetch-depth: 0 - name: Set up JDK 17 - uses: actions/setup-java@v3.1.0 + uses: actions/setup-java@v3.1.1 with: distribution: 'adopt' java-version: '17' From 34493d1a0309098bd8c8c951751cbd4687699329 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Apr 2022 11:24:03 +0000 Subject: [PATCH 03/34] =?UTF-8?q?=F0=9F=94=A7=20Bump=20unirest-java=20from?= =?UTF-8?q?=203.13.7=20to=203.13.8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [unirest-java](https://github.com/Kong/unirest-java) from 3.13.7 to 3.13.8. - [Release notes](https://github.com/Kong/unirest-java/releases) - [Changelog](https://github.com/Kong/unirest-java/blob/main/CHANGELOG.md) - [Commits](https://github.com/Kong/unirest-java/compare/v3.13.7...v3.13.8) --- updated-dependencies: - dependency-name: com.konghq:unirest-java dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8d4d75b88f..13c6cd0845 100644 --- a/pom.xml +++ b/pom.xml @@ -245,7 +245,7 @@ com.konghq unirest-java - 3.13.7 + 3.13.8 compile From 1d6ee21a8a05ecabfbcf8a86179baf7f1df076bd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Apr 2022 11:20:01 +0000 Subject: [PATCH 04/34] =?UTF-8?q?=F0=9F=94=A7=20Bump=20maven-git-versionin?= =?UTF-8?q?g-extension=20from=207.3.0=20to=207.4.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [maven-git-versioning-extension](https://github.com/qoomon/maven-git-versioning-extension) from 7.3.0 to 7.4.0. - [Release notes](https://github.com/qoomon/maven-git-versioning-extension/releases) - [Changelog](https://github.com/qoomon/maven-git-versioning-extension/blob/master/CHANGELOG.md) - [Commits](https://github.com/qoomon/maven-git-versioning-extension/compare/v7.3.0...v7.4.0) --- updated-dependencies: - dependency-name: me.qoomon:maven-git-versioning-extension dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .mvn/extensions.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml index 8b5b10a7c2..4275b46692 100644 --- a/.mvn/extensions.xml +++ b/.mvn/extensions.xml @@ -4,7 +4,7 @@ me.qoomon maven-git-versioning-extension - 7.3.0 + 7.4.0 \ No newline at end of file From 4e4cc24fef76de9b9a7454ff2addf6c3c62cd3a8 Mon Sep 17 00:00:00 2001 From: Xzavier0722 Date: Mon, 18 Apr 2022 13:13:32 +0800 Subject: [PATCH 05/34] fix(protection): add protection check for move/attack actions of android --- .../items/androids/ButcherAndroid.java | 10 ++++++++++ .../items/androids/ProgrammableAndroid.java | 14 ++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ButcherAndroid.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ButcherAndroid.java index 3b9aed0a2f..1c0f4abb1c 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ButcherAndroid.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ButcherAndroid.java @@ -1,7 +1,12 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.androids; +import java.util.UUID; import java.util.function.Predicate; +import io.github.bakedlibs.dough.protection.Interaction; +import me.mrCookieSlime.Slimefun.api.BlockStorage; +import org.bukkit.Bukkit; +import org.bukkit.OfflinePlayer; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.entity.ArmorStand; @@ -59,6 +64,11 @@ protected void attack(Block b, BlockFace face, Predicate predicate n.removeMetadata(METADATA_KEY, Slimefun.instance()); } + OfflinePlayer owner = Bukkit.getOfflinePlayer(UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner"))); + if (!Slimefun.getProtectionManager().hasPermission(owner, n.getLocation(), Interaction.ATTACK_ENTITY)) { + return; + } + n.setMetadata(METADATA_KEY, new FixedMetadataValue(Slimefun.instance(), new AndroidInstance(this, b))); ((LivingEntity) n).damage(damage); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ProgrammableAndroid.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ProgrammableAndroid.java index 2f29327539..a0522fa495 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ProgrammableAndroid.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ProgrammableAndroid.java @@ -901,10 +901,16 @@ public void addItems(Block b, ItemStack... items) { protected void move(Block b, BlockFace face, Block block) { Player p = Bukkit.getPlayer(IntegrationHelper.getOwnerFromJson(BlockStorage.getBlockInfoAsJson(b.getLocation()))); - if (p != null && !IntegrationHelper.checkPermission(p, block, Interaction.PLACE_BLOCK)) { - BlockStorage.addBlockInfo(b, "paused", "false"); - Slimefun.getLocalization().sendMessage(p, "messages.android-no-permission", true); - return; + if (p != null) { + if (!Slimefun.getProtectionManager().hasPermission(p, block, Interaction.PLACE_BLOCK)) { + return; + } + + if (!IntegrationHelper.checkPermission(p, block, Interaction.PLACE_BLOCK)) { + BlockStorage.addBlockInfo(b, "paused", "false"); + Slimefun.getLocalization().sendMessage(p, "messages.android-no-permission", true); + return; + } } if (block.getY() > WorldUtils.getMinHeight(block.getWorld()) && block.getY() < block.getWorld().getMaxHeight() && block.isEmpty()) { From 3e0a1b05101d5b94f299fa82dcc46d97cda0087d Mon Sep 17 00:00:00 2001 From: Xzavier0722 Date: Mon, 18 Apr 2022 16:49:53 +0800 Subject: [PATCH 06/34] fix(protection): add protection check for farm action of android --- .../implementation/items/androids/FarmerAndroid.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FarmerAndroid.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FarmerAndroid.java index 9834237ea7..7412bca7eb 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FarmerAndroid.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FarmerAndroid.java @@ -1,13 +1,18 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.androids; import java.util.Random; +import java.util.UUID; import java.util.concurrent.ThreadLocalRandom; import javax.annotation.ParametersAreNonnullByDefault; +import io.github.bakedlibs.dough.protection.Interaction; +import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; +import me.mrCookieSlime.Slimefun.api.BlockStorage; import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.Material; +import org.bukkit.OfflinePlayer; import org.bukkit.block.Block; import org.bukkit.block.data.Ageable; import org.bukkit.block.data.BlockData; @@ -34,6 +39,12 @@ public AndroidType getAndroidType() { @Override protected void farm(Block b, BlockMenu menu, Block block, boolean isAdvanced) { + + OfflinePlayer owner = Bukkit.getOfflinePlayer(UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner"))); + if (!Slimefun.getProtectionManager().hasPermission(owner, block, Interaction.BREAK_BLOCK)) { + return; + } + Material blockType = block.getType(); BlockData data = block.getBlockData(); ItemStack drop = null; From c97d6a56497249b36f56b142af43e3e79b206d23 Mon Sep 17 00:00:00 2001 From: Xzavier0722 Date: Tue, 19 Apr 2022 12:33:41 +0800 Subject: [PATCH 07/34] improve(command): add click to copy action for /sf id --- .../commands/subcommands/ItemIdCommand.java | 23 +++++++++++++++---- .../resources/languages/zh-CN/messages.yml | 1 + 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ItemIdCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ItemIdCommand.java index 694b4a2413..cf24fbf04a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ItemIdCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ItemIdCommand.java @@ -5,18 +5,25 @@ import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand; import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; +import net.md_5.bungee.api.ChatColor; +import net.md_5.bungee.api.chat.ClickEvent; +import net.md_5.bungee.api.chat.HoverEvent; +import net.md_5.bungee.api.chat.TextComponent; +import net.md_5.bungee.api.chat.hover.content.Text; import org.bukkit.Material; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import javax.annotation.Nonnull; + class ItemIdCommand extends SubCommand { protected ItemIdCommand(Slimefun plugin, SlimefunCommand cmd) { super(plugin, cmd, "id", false); } @Override - public void onExecute(CommandSender sender, String[] args) { + public void onExecute(@Nonnull CommandSender sender, @Nonnull String[] args) { if (sender instanceof Player) { if (sender.hasPermission("slimefun.command.id")) { Player p = (Player) sender; @@ -24,12 +31,20 @@ public void onExecute(CommandSender sender, String[] args) { if (item.getType() != Material.AIR) { SlimefunItem sfItem = SlimefunItem.getByItem(item); if (sfItem != null) { - sender.sendMessage(ChatColors.color("The item's id: " + sfItem.getId())); + String sfId = sfItem.getId(); + TextComponent msg = new TextComponent("该物品的ID为: "); + TextComponent idMsg = new TextComponent(sfId); + idMsg.setUnderlined(true); + idMsg.setItalic(true); + idMsg.setColor(ChatColor.GRAY); + idMsg.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("点击复制到剪贴板"))); + idMsg.setClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, sfId)); + sender.spigot().sendMessage(msg, idMsg); } else { - Slimefun.getLocalization().sendMessage(sender, "messages.not-valid-item", true); + Slimefun.getLocalization().sendMessage(sender, "messages.invalid-item-in-hand", true); } } else { - sender.sendMessage(ChatColors.color("&bYou have nothing in your main hand!")); + sender.sendMessage(ChatColors.color("&b请将需要查看的物品拿在主手!")); } } else { Slimefun.getLocalization().sendMessage(sender, "messages.no-permission", true); diff --git a/src/main/resources/languages/zh-CN/messages.yml b/src/main/resources/languages/zh-CN/messages.yml index f204de9c6e..00f525393d 100644 --- a/src/main/resources/languages/zh-CN/messages.yml +++ b/src/main/resources/languages/zh-CN/messages.yml @@ -143,6 +143,7 @@ messages: not-online: '&4%player% &c不在线' invalid-item: '&4%item% &c不是一个有效的物品名!' invalid-amount: '&4%amount% &ci不是一个有效的数字 : 它必须大于 0!' + invalid-item-in-hand: '&e你手中拿的不是粘液科技的物品!' given-item: '&b你获得了 &a%amount% &7"%item%&7"' give-item: '&b成功给予玩家 %player% &a%amount% &7"%item%&7"' invalid-research: '&4%research% &c不是一个有效的研究名!' From b5e2b2160c08e0f398b44faafeaa5bc3417c2a21 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 19 Apr 2022 19:23:17 +0200 Subject: [PATCH 08/34] [CI skip] Update actions/checkout action to v3.0.1 --- .github/workflows/discord-webhook.yml | 2 +- .github/workflows/sonarcloud.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/discord-webhook.yml b/.github/workflows/discord-webhook.yml index 47de6d6c16..2fb1812b28 100644 --- a/.github/workflows/discord-webhook.yml +++ b/.github/workflows/discord-webhook.yml @@ -18,7 +18,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3.0.0 + uses: actions/checkout@v3.0.1 - name: Set up Java JDK 17 uses: actions/setup-java@v3.1.1 diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index b8486bc107..02d8c33fab 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3.0.0 + uses: actions/checkout@v3.0.1 with: fetch-depth: 0 From 5d093822de1340fd96c692b237a33a9efbd4174a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 19 Apr 2022 19:23:40 +0200 Subject: [PATCH 09/34] [CI skip] Update dependency com.konghq:unirest-java to v3.13.8 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9d47086c76..b05b167391 100644 --- a/pom.xml +++ b/pom.xml @@ -362,7 +362,7 @@ com.konghq unirest-java - 3.13.7 + 3.13.8 compile From 217196c137bb2b22d1fc4232ee733d6dcfe01102 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Tue, 19 Apr 2022 20:51:13 +0200 Subject: [PATCH 10/34] Fixed #3534 --- CHANGELOG.md | 1 + .../thebusybiscuit/slimefun4/utils/ChestMenuUtils.java | 2 +- .../Objects/SlimefunItem/abstractItems/AContainer.java | 6 +++++- .../thebusybiscuit/slimefun4/utils/TestFireworkUtils.java | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9f229ad6d..21524f31de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ #### Fixes * Fixed #3445 * Fixed #3504 +* Fixed #3534 ## Release Candidate 31 (14 Mar 2022) https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#31 diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ChestMenuUtils.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ChestMenuUtils.java index 8397512390..85f20f08fe 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ChestMenuUtils.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ChestMenuUtils.java @@ -142,7 +142,7 @@ public static void updateProgressbar(@Nonnull ChestMenu menu, int slot, int time } im.setDisplayName(" "); - im.setLore(Arrays.asList(getProgressBar(timeLeft, time), "", ChatColor.GRAY + NumberUtils.getTimeLeft(timeLeft / 2) + " left")); + im.setLore(Arrays.asList(getProgressBar(timeLeft, time), "", ChatColor.GRAY + NumberUtils.getTimeLeft(timeLeft / 2))); item.setItemMeta(im); menu.replaceExistingItem(slot, item); diff --git a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AContainer.java b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AContainer.java index e9b74f3985..be71fbe598 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AContainer.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AContainer.java @@ -372,7 +372,11 @@ protected void tick(Block b) { MachineRecipe next = findNextRecipe(inv); if (next != null) { - processor.startOperation(b, new CraftingOperation(next)); + currentOperation = new CraftingOperation(next); + processor.startOperation(b, currentOperation); + + // Fixes #3534 - Update indicator immediately + processor.updateProgressBar(inv, 22, currentOperation); } } } diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestFireworkUtils.java b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestFireworkUtils.java index c979f740e2..a32183d663 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestFireworkUtils.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestFireworkUtils.java @@ -21,7 +21,7 @@ import be.seeseemelk.mockbukkit.WorldMock; class TestFireworkUtils { - + private static World world; @BeforeAll From 020af6743cf67af44682f8fa6906e31be3997d12 Mon Sep 17 00:00:00 2001 From: Xzavier0722 Date: Wed, 20 Apr 2022 09:23:01 +0800 Subject: [PATCH 11/34] improve(updater): optimize version checking --- .../slimefunextra/UpdateChecker.java | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/main/java/ren/natsuyuk1/slimefunextra/UpdateChecker.java b/src/main/java/ren/natsuyuk1/slimefunextra/UpdateChecker.java index e475537359..010eaed92d 100644 --- a/src/main/java/ren/natsuyuk1/slimefunextra/UpdateChecker.java +++ b/src/main/java/ren/natsuyuk1/slimefunextra/UpdateChecker.java @@ -30,23 +30,30 @@ public static void checkUpdate() { if (Slimefun.instance() != null) { String latestVersionCode = node.getObject().getString("tag_name"); - String currentYear = latestVersionCode.split("\\.")[0]; - String currentMonth = latestVersionCode.split("\\.")[1]; - - // Get last string String[] versionCodeSplit = currentVersion.split("-"); - String actualVersionCode = versionCodeSplit[versionCodeSplit.length - 1]; + String version = null; + for (String str : versionCodeSplit) { + if (str.startsWith("20")) { + String[] code = str.split("\\."); + if (code.length < 2) { + Slimefun.logger().warning("无法识别当前版本: " + currentVersion); + return; + } + version = code[0] + "." + code[1]; + } + } - String year = actualVersionCode.split("\\.")[0]; - String month = actualVersionCode.split("\\.")[1]; + if (version == null) { + Slimefun.logger().warning("无法识别当前版本: " + currentVersion); + return; + } - if (Integer.parseInt(currentYear) > Integer.parseInt(year) - || (Integer.parseInt(year) == Integer.parseInt(currentYear) - && Integer.parseInt(currentMonth) > Integer.parseInt(month))) { + if (latestVersionCode.compareTo(version) > 0) { Slimefun.logger().info("新版本 " + latestVersionCode + " 已发布,请前往 https://gitee.com/StarWishsama/Slimefun4/releases 更新."); } else { Slimefun.logger().info("你正在使用最新版本 " + currentVersion + "."); } + } } } catch (Exception e) { From ec79423123e49b0d43f34fceebae6b20327c5eb6 Mon Sep 17 00:00:00 2001 From: = Date: Wed, 20 Apr 2022 22:45:04 +0100 Subject: [PATCH 12/34] Fix Arithmetic Error --- .../slimefun4/core/machines/MachineProcessor.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/machines/MachineProcessor.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/machines/MachineProcessor.java index 71aa91b8a5..f0c2607a29 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/machines/MachineProcessor.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/machines/MachineProcessor.java @@ -251,6 +251,12 @@ public void updateProgressBar(@Nonnull BlockMenu inv, int slot, @Nonnull T opera // Update the progress bar in our inventory (if anyone is watching) int remainingTicks = operation.getRemainingTicks(); int totalTicks = operation.getTotalTicks(); + + // If the operation is finished, we don't need to update the progress bar. + if (remainingTicks <= 0 && totalTicks <= 0) { + return; + } + ChestMenuUtils.updateProgressbar(inv, slot, remainingTicks, totalTicks, getProgressBar()); } From 0a3508529c390897226b928ebb97388ed13f5413 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 21 Apr 2022 00:08:36 +0200 Subject: [PATCH 13/34] [CI skip] Update dependency org.mockito:mockito-core to v4.5.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b05b167391..69f17e50ba 100644 --- a/pom.xml +++ b/pom.xml @@ -384,7 +384,7 @@ org.mockito mockito-core - 4.4.0 + 4.5.0 test From 6f89dffaf539be481c0a3f95265b173fd27ca047 Mon Sep 17 00:00:00 2001 From: StarWishsama Date: Thu, 21 Apr 2022 23:19:06 +0800 Subject: [PATCH 14/34] :pencil2: trans(fuel): closes #532 --- .../thebusybiscuit/slimefun4/implementation/SlimefunItems.java | 2 +- .../implementation/items/androids/AndroidFuelSource.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java index 7c7457c83b..ed5da474de 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java @@ -531,7 +531,7 @@ private SlimefunItems() { public static final SlimefunItemStack URANIUM = new SlimefunItemStack("URANIUM", HeadTexture.URANIUM, "&4铀", "", LoreBuilder.radioactive(Radioactivity.HIGH), LoreBuilder.HAZMAT_SUIT_REQUIRED); public static final SlimefunItemStack NEPTUNIUM = new SlimefunItemStack("NEPTUNIUM", HeadTexture.NEPTUNIUM, "&a镎", "", LoreBuilder.radioactive(Radioactivity.HIGH), LoreBuilder.HAZMAT_SUIT_REQUIRED); public static final SlimefunItemStack PLUTONIUM = new SlimefunItemStack("PLUTONIUM", HeadTexture.PLUTONIUM, "&7钚", "", LoreBuilder.radioactive(Radioactivity.VERY_HIGH), LoreBuilder.HAZMAT_SUIT_REQUIRED); - public static final SlimefunItemStack BOOSTED_URANIUM = new SlimefunItemStack("BOOSTED_URANIUM", HeadTexture.BOOSTED_URANIUM, "&2高纯度铀", "", LoreBuilder.radioactive(Radioactivity.VERY_HIGH), LoreBuilder.HAZMAT_SUIT_REQUIRED); + public static final SlimefunItemStack BOOSTED_URANIUM = new SlimefunItemStack("BOOSTED_URANIUM", HeadTexture.BOOSTED_URANIUM, "&2钚铀混合氧化物核燃料", "", LoreBuilder.radioactive(Radioactivity.VERY_HIGH), LoreBuilder.HAZMAT_SUIT_REQUIRED); /* Talisman */ public static final SlimefunItemStack COMMON_TALISMAN = new SlimefunItemStack("COMMON_TALISMAN", Material.EMERALD, "&6普通护身符"); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/AndroidFuelSource.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/AndroidFuelSource.java index 535e35710f..d3c313b76b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/AndroidFuelSource.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/AndroidFuelSource.java @@ -28,7 +28,7 @@ public enum AndroidFuelSource { /** * This {@link ProgrammableAndroid} runs on nuclear fuel, e.g. Uranium */ - NUCLEAR("", "&f这类机器人需要放射性燃料", "&f例如铀, 镎或强化铀"); + NUCLEAR("", "&f这类机器人需要放射性燃料", "&f例如铀, 镎或钚铀混合氧化物核燃料"); private final String[] lore; From 7f70570260b459f55d54c11feaa0120f77fc77f2 Mon Sep 17 00:00:00 2001 From: itslukemango Date: Fri, 22 Apr 2022 12:11:27 +0100 Subject: [PATCH 15/34] Update src/main/java/io/github/thebusybiscuit/slimefun4/core/machines/MachineProcessor.java Co-authored-by: TheBusyBiscuit --- .../slimefun4/core/machines/MachineProcessor.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/machines/MachineProcessor.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/machines/MachineProcessor.java index f0c2607a29..33ccb4111d 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/machines/MachineProcessor.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/machines/MachineProcessor.java @@ -252,12 +252,10 @@ public void updateProgressBar(@Nonnull BlockMenu inv, int slot, @Nonnull T opera int remainingTicks = operation.getRemainingTicks(); int totalTicks = operation.getTotalTicks(); - // If the operation is finished, we don't need to update the progress bar. - if (remainingTicks <= 0 && totalTicks <= 0) { - return; + // Fixes #3538 - If the operation is finished, we don't need to update the progress bar. + if (remainingTicks > 0 || totalTicks > 0) { + ChestMenuUtils.updateProgressbar(inv, slot, remainingTicks, totalTicks, getProgressBar()); } - - ChestMenuUtils.updateProgressbar(inv, slot, remainingTicks, totalTicks, getProgressBar()); } } From 20512b726a6354ecf0f35e90b709603c25205bb8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 22 Apr 2022 11:24:33 +0000 Subject: [PATCH 16/34] =?UTF-8?q?=F0=9F=94=A7=20Bump=20mockito-core=20from?= =?UTF-8?q?=204.5.0=20to=204.5.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [mockito-core](https://github.com/mockito/mockito) from 4.5.0 to 4.5.1. - [Release notes](https://github.com/mockito/mockito/releases) - [Commits](https://github.com/mockito/mockito/compare/v4.5.0...v4.5.1) --- updated-dependencies: - dependency-name: org.mockito:mockito-core dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b78d5c4c3a..e29c59d169 100644 --- a/pom.xml +++ b/pom.xml @@ -267,7 +267,7 @@ org.mockito mockito-core - 4.5.0 + 4.5.1 test From 3021a8efa99301b61c056f4d336f08abb038ceb5 Mon Sep 17 00:00:00 2001 From: craftish37 <63811617+craftish37@users.noreply.github.com> Date: Fri, 22 Apr 2022 15:19:38 +0200 Subject: [PATCH 17/34] Added Seagrass recipe (suggestion #398 from Mr.Moules) --- .../implementation/items/electric/machines/FoodFabricator.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/FoodFabricator.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/FoodFabricator.java index 3af077f713..a22efe9f1a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/FoodFabricator.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/FoodFabricator.java @@ -29,6 +29,7 @@ protected void registerDefaultRecipes() { registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, new ItemStack(Material.DRIED_KELP) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.KELP_ORGANIC_FOOD, OrganicFood.OUTPUT) }); registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, new ItemStack(Material.COCOA_BEANS) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.COCOA_ORGANIC_FOOD, OrganicFood.OUTPUT) }); registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, new ItemStack(Material.SWEET_BERRIES) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.SWEET_BERRIES_ORGANIC_FOOD, OrganicFood.OUTPUT) }); + registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, new ItemStack(Material.SEAGRASS) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.SEAGRASS_ORGANIC_FOOD, OrganicFood.OUTPUT) }); } @Override From 1a5c3f024f14e79eb9d5ebe40be7107888398f3f Mon Sep 17 00:00:00 2001 From: craftish37 Date: Fri, 22 Apr 2022 16:02:21 +0200 Subject: [PATCH 18/34] Forgot to use my damn brain (Also added Seagrass Fertilizer) --- .../slimefun4/implementation/SlimefunItems.java | 2 ++ .../items/electric/machines/FoodComposter.java | 1 + .../slimefun4/implementation/setup/ResearchSetup.java | 4 ++-- .../slimefun4/implementation/setup/SlimefunItemSetup.java | 6 ++++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java index 60f52eb9e2..ea54169f16 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java @@ -800,6 +800,7 @@ private SlimefunItems() {} public static final SlimefunItemStack SWEET_BERRIES_ORGANIC_FOOD = new SlimefunItemStack("ORGANIC_FOOD_SWEET_BERRIES", HeadTexture.FILLED_CAN, ORGANIC_FOOD.getDisplayName(), "&7Content: &9Sweet Berries"); public static final SlimefunItemStack KELP_ORGANIC_FOOD = new SlimefunItemStack("ORGANIC_FOOD_KELP", HeadTexture.FILLED_CAN, ORGANIC_FOOD.getDisplayName(), "&7Content: &9Dried Kelp"); public static final SlimefunItemStack COCOA_ORGANIC_FOOD = new SlimefunItemStack("ORGANIC_FOOD_COCOA", HeadTexture.FILLED_CAN, ORGANIC_FOOD.getDisplayName(), "&7Content: &9Cocoa Beans"); + public static final SlimefunItemStack SEAGRASS_ORGANIC_FOOD = new SlimefunItemStack("ORGANIC_FOOD_SEAGRASS", HeadTexture.FILLED_CAN, ORGANIC_FOOD.getDisplayName(), "&7Content: &9Seagrass"); public static final SlimefunItemStack FERTILIZER = new SlimefunItemStack("FERTILIZER", HeadTexture.FILLED_CAN, "&aOrganic Fertilizer", "&7Content: &9???"); public static final SlimefunItemStack WHEAT_FERTILIZER = new SlimefunItemStack("FERTILIZER_WHEAT", HeadTexture.FILLED_CAN, FERTILIZER.getDisplayName(), "&7Content: &9Wheat"); @@ -812,6 +813,7 @@ private SlimefunItems() {} public static final SlimefunItemStack SWEET_BERRIES_FERTILIZER = new SlimefunItemStack("FERTILIZER_SWEET_BERRIES", HeadTexture.FILLED_CAN, FERTILIZER.getDisplayName(), "&7Content: &9Sweet Berries"); public static final SlimefunItemStack KELP_FERTILIZER = new SlimefunItemStack("FERTILIZER_KELP", HeadTexture.FILLED_CAN, FERTILIZER.getDisplayName(), "&7Content: &9Dried Kelp"); public static final SlimefunItemStack COCOA_FERTILIZER = new SlimefunItemStack("FERTILIZER_COCOA", HeadTexture.FILLED_CAN, FERTILIZER.getDisplayName(), "&7Content: &9Cocoa beans"); + public static final SlimefunItemStack SEAGRASS_FERTILIZER = new SlimefunItemStack("FERTILIZER_SEAGRASS", HeadTexture.FILLED_CAN, FERTILIZER.getDisplayName(), "&7Content: &9Seagrass"); public static final SlimefunItemStack ANIMAL_GROWTH_ACCELERATOR = new SlimefunItemStack("ANIMAL_GROWTH_ACCELERATOR", Material.HAY_BLOCK, "&bAnimal Growth Accelerator", "", "&fRuns on &aOrganic Food", "", LoreBuilder.machine(MachineTier.END_GAME, MachineType.MACHINE), LoreBuilder.powerBuffer(1024), LoreBuilder.powerPerSecond(28)); public static final SlimefunItemStack CROP_GROWTH_ACCELERATOR = new SlimefunItemStack("CROP_GROWTH_ACCELERATOR", Material.LIME_TERRACOTTA, "&aCrop Growth Accelerator", "", "&fRuns on &aOrganic Fertilizer", "", LoreBuilder.machine(MachineTier.END_GAME, MachineType.MACHINE), "&8\u21E8 &7Radius: 7x7", "&8\u21E8 &7Speed: &a3/time", LoreBuilder.powerBuffer(1024), LoreBuilder.powerPerSecond(50)); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/FoodComposter.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/FoodComposter.java index 4ea3d5cf98..04f70d5490 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/FoodComposter.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/FoodComposter.java @@ -30,6 +30,7 @@ protected void registerDefaultRecipes() { registerRecipe(30, new ItemStack[] { SlimefunItems.KELP_ORGANIC_FOOD }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.KELP_FERTILIZER, OrganicFertilizer.OUTPUT) }); registerRecipe(30, new ItemStack[] { SlimefunItems.COCOA_ORGANIC_FOOD }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.COCOA_FERTILIZER, OrganicFertilizer.OUTPUT) }); registerRecipe(30, new ItemStack[] { SlimefunItems.SWEET_BERRIES_ORGANIC_FOOD }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.SWEET_BERRIES_FERTILIZER, OrganicFertilizer.OUTPUT) }); + registerRecipe(30, new ItemStack[] { SlimefunItems.SEAGRASS_ORGANIC_FOOD }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.SEAGRASS_FERTILIZER, OrganicFertilizer.OUTPUT) }); } @Override diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/ResearchSetup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/ResearchSetup.java index fa12c1e9e9..4635c1b4dd 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/ResearchSetup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/ResearchSetup.java @@ -200,14 +200,14 @@ public static void setupResearches() { register("energized_gps_transmitter", 189, "Top Tier Transmitter", 44, SlimefunItems.GPS_TRANSMITTER_4); register("energy_regulator", 190, "Energy Networks 101", 6, SlimefunItems.ENERGY_REGULATOR); register("butcher_androids", 191, "Butcher Androids", 32, SlimefunItems.PROGRAMMABLE_ANDROID_BUTCHER); - register("organic_food", 192, "Organic Food", 25, SlimefunItems.FOOD_FABRICATOR, SlimefunItems.WHEAT_ORGANIC_FOOD, SlimefunItems.CARROT_ORGANIC_FOOD, SlimefunItems.POTATO_ORGANIC_FOOD, SlimefunItems.SEEDS_ORGANIC_FOOD, SlimefunItems.BEETROOT_ORGANIC_FOOD, SlimefunItems.MELON_ORGANIC_FOOD, SlimefunItems.APPLE_ORGANIC_FOOD, SlimefunItems.SWEET_BERRIES_ORGANIC_FOOD, SlimefunItems.KELP_ORGANIC_FOOD, SlimefunItems.COCOA_ORGANIC_FOOD); + register("organic_food", 192, "Organic Food", 25, SlimefunItems.FOOD_FABRICATOR, SlimefunItems.WHEAT_ORGANIC_FOOD, SlimefunItems.CARROT_ORGANIC_FOOD, SlimefunItems.POTATO_ORGANIC_FOOD, SlimefunItems.SEEDS_ORGANIC_FOOD, SlimefunItems.BEETROOT_ORGANIC_FOOD, SlimefunItems.MELON_ORGANIC_FOOD, SlimefunItems.APPLE_ORGANIC_FOOD, SlimefunItems.SWEET_BERRIES_ORGANIC_FOOD, SlimefunItems.KELP_ORGANIC_FOOD, SlimefunItems.COCOA_ORGANIC_FOOD, SlimefunItems.SEAGRASS_ORGANIC_FOOD); register("auto_breeder", 193, "Automated Feeding", 25, SlimefunItems.AUTO_BREEDER); register("advanced_android", 194, "Advanced Androids", 60, SlimefunItems.PROGRAMMABLE_ANDROID_2); register("advanced_butcher_android", 195, "Advanced Androids - Butcher", 30, SlimefunItems.PROGRAMMABLE_ANDROID_2_BUTCHER); register("advanced_fisherman_android", 196, "Advanced Androids - Fisherman", 30, SlimefunItems.PROGRAMMABLE_ANDROID_2_FISHERMAN); register("animal_growth_accelerator", 197, "Animal Growth Manipulation", 32, SlimefunItems.ANIMAL_GROWTH_ACCELERATOR); register("xp_collector", 198, "XP Collector", 36, SlimefunItems.EXP_COLLECTOR); - register("organic_fertilizer", 199, "Organic Fertilizer", 36, SlimefunItems.FOOD_COMPOSTER, SlimefunItems.WHEAT_FERTILIZER, SlimefunItems.CARROT_FERTILIZER, SlimefunItems.POTATO_FERTILIZER, SlimefunItems.SEEDS_FERTILIZER, SlimefunItems.BEETROOT_FERTILIZER, SlimefunItems.MELON_FERTILIZER, SlimefunItems.APPLE_FERTILIZER, SlimefunItems.SWEET_BERRIES_FERTILIZER, SlimefunItems.KELP_FERTILIZER, SlimefunItems.COCOA_FERTILIZER); + register("organic_fertilizer", 199, "Organic Fertilizer", 36, SlimefunItems.FOOD_COMPOSTER, SlimefunItems.WHEAT_FERTILIZER, SlimefunItems.CARROT_FERTILIZER, SlimefunItems.POTATO_FERTILIZER, SlimefunItems.SEEDS_FERTILIZER, SlimefunItems.BEETROOT_FERTILIZER, SlimefunItems.MELON_FERTILIZER, SlimefunItems.APPLE_FERTILIZER, SlimefunItems.SWEET_BERRIES_FERTILIZER, SlimefunItems.KELP_FERTILIZER, SlimefunItems.COCOA_FERTILIZER, SlimefunItems.SEAGRASS_FERTILIZER); register("crop_growth_accelerator", 200, "Crop Growth Acceleration", 40, SlimefunItems.CROP_GROWTH_ACCELERATOR); register("better_crop_growth_accelerator", 201, "Upgraded Crop Growth Accelerator", 44, SlimefunItems.CROP_GROWTH_ACCELERATOR_2); register("reactor_essentials", 202, "Reactor Essentials", 36, SlimefunItems.REACTOR_COOLANT_CELL, SlimefunItems.NEPTUNIUM, SlimefunItems.PLUTONIUM); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java index 03336c7148..e0c7abfdd7 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java @@ -2324,6 +2324,9 @@ public int getEnergyConsumption() { new OrganicFood(itemGroups.misc, SlimefunItems.COCOA_ORGANIC_FOOD, Material.COCOA_BEANS) .register(plugin); + new OrganicFood(itemGroups.misc, SlimefunItems.SEAGRASS_ORGANIC_FOOD, Material.SEAGRASS) + .register(plugin); + new AutoBreeder(itemGroups.electricity, SlimefunItems.AUTO_BREEDER, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] {SlimefunItems.GOLD_18K, SlimefunItems.TIN_CAN, SlimefunItems.GOLD_18K, SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.HAY_BLOCK), SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.LEAD_INGOT, SlimefunItems.FOOD_FABRICATOR, SlimefunItems.LEAD_INGOT}) .register(plugin); @@ -2384,6 +2387,9 @@ public int getEnergyConsumption() { new OrganicFertilizer(itemGroups.misc, SlimefunItems.COCOA_FERTILIZER, SlimefunItems.COCOA_ORGANIC_FOOD) .register(plugin); + new OrganicFertilizer(itemGroups.misc, SlimefunItems.SEAGRASS_FERTILIZER, SlimefunItems.SEAGRASS_ORGANIC_FOOD) + .register(plugin); + new CropGrowthAccelerator(itemGroups.electricity, SlimefunItems.CROP_GROWTH_ACCELERATOR, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] {null, SlimefunItems.BLISTERING_INGOT_3, null, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.PROGRAMMABLE_ANDROID_FARMER, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.ANIMAL_GROWTH_ACCELERATOR, SlimefunItems.ELECTRO_MAGNET}) { From 76444df8f57753044ca7e4912757794099b7b602 Mon Sep 17 00:00:00 2001 From: craftish37 <63811617+craftish37@users.noreply.github.com> Date: Fri, 22 Apr 2022 16:31:27 +0200 Subject: [PATCH 19/34] Formatting Co-authored-by: Varian Anora --- .../slimefun4/implementation/setup/SlimefunItemSetup.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java index e0c7abfdd7..d64323ef9c 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java @@ -2387,7 +2387,7 @@ public int getEnergyConsumption() { new OrganicFertilizer(itemGroups.misc, SlimefunItems.COCOA_FERTILIZER, SlimefunItems.COCOA_ORGANIC_FOOD) .register(plugin); - new OrganicFertilizer(itemGroups.misc, SlimefunItems.SEAGRASS_FERTILIZER, SlimefunItems.SEAGRASS_ORGANIC_FOOD) + new OrganicFertilizer(itemGroups.misc, SlimefunItems.SEAGRASS_FERTILIZER, SlimefunItems.SEAGRASS_ORGANIC_FOOD) .register(plugin); new CropGrowthAccelerator(itemGroups.electricity, SlimefunItems.CROP_GROWTH_ACCELERATOR, RecipeType.ENHANCED_CRAFTING_TABLE, From 6d62d0e9a4d5a5dc587ddd542e227ab6a660787d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 23 Apr 2022 13:14:17 +0200 Subject: [PATCH 20/34] [CI skip] Update actions/checkout action to v3.0.2 --- .github/workflows/discord-webhook.yml | 2 +- .github/workflows/sonarcloud.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/discord-webhook.yml b/.github/workflows/discord-webhook.yml index 2fb1812b28..a71c040609 100644 --- a/.github/workflows/discord-webhook.yml +++ b/.github/workflows/discord-webhook.yml @@ -18,7 +18,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3.0.1 + uses: actions/checkout@v3.0.2 - name: Set up Java JDK 17 uses: actions/setup-java@v3.1.1 diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 02d8c33fab..2565e0f593 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3.0.1 + uses: actions/checkout@v3.0.2 with: fetch-depth: 0 From 2e5962c87f0188a9dc6a20142c5995b8862737e7 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 23 Apr 2022 13:14:23 +0200 Subject: [PATCH 21/34] [CI skip] Update dependency org.apache.maven.plugins:maven-javadoc-plugin to v3.4.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 69f17e50ba..e4dc768532 100644 --- a/pom.xml +++ b/pom.xml @@ -235,7 +235,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.3.2 + 3.4.0 ${project.basedir} From 63d70a52db6f02da67a1e2326f84e2fc6a30e8a4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 23 Apr 2022 13:14:37 +0200 Subject: [PATCH 22/34] [CI skip] Update dependency org.mockito:mockito-core to v4.5.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e4dc768532..084ba4c72d 100644 --- a/pom.xml +++ b/pom.xml @@ -384,7 +384,7 @@ org.mockito mockito-core - 4.5.0 + 4.5.1 test From dee40e48cf062e332d4882ddb0d59ab33096429a Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sat, 23 Apr 2022 13:20:26 +0200 Subject: [PATCH 23/34] [CI skip] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 21524f31de..f59bdd74e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ * Fixed #3445 * Fixed #3504 * Fixed #3534 +* Fixed #3538 ## Release Candidate 31 (14 Mar 2022) https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#31 From ab6790aed0c76cd3a94a566e6fabd29f7c0438b1 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sun, 24 Apr 2022 19:26:09 +0200 Subject: [PATCH 24/34] [CI skip] Updated changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f59bdd74e5..f68b2e42c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,8 @@ ## Release Candidate 32 (TBD) #### Additions +* Added Organic Food for Seagrass +* Added Organic Fertilizer for Seagrass #### Changes From edead33c8f3238b6a5c87f0d70b467f502bb8904 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 25 Apr 2022 18:02:03 +0200 Subject: [PATCH 25/34] [CI skip] Update thollander/actions-comment-pull-request action to v1.3.0 --- .github/workflows/pr-labels.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml index 3d7d7ef4be..634b5c6a76 100644 --- a/.github/workflows/pr-labels.yml +++ b/.github/workflows/pr-labels.yml @@ -27,7 +27,7 @@ jobs: api: '🔧 API' compatibility: '🤝 Compatibility' - - uses: thollander/actions-comment-pull-request@v1.1.0 + - uses: thollander/actions-comment-pull-request@v1.3.0 name: Leave a comment about the applied label if: ${{ steps.labeller.outputs.applied != 0 }} with: @@ -36,7 +36,7 @@ jobs: Your Pull Request was automatically labelled as: "${{ steps.labeller.outputs.applied }}" Thank you for contributing to this project! ❤️ - - uses: thollander/actions-comment-pull-request@v1.1.0 + - uses: thollander/actions-comment-pull-request@v1.3.0 name: Leave a comment about our branch naming convention if: ${{ steps.labeller.outputs.applied == 0 }} with: From 5cfc4f725e6177bc609da44b79f0e39decdd0d17 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Mon, 25 Apr 2022 18:12:02 +0200 Subject: [PATCH 26/34] Fixed #3548 --- CHANGELOG.md | 1 + .../implementation/guide/SurvivalSlimefunGuide.java | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f68b2e42c0..75c8375773 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ * Fixed #3504 * Fixed #3534 * Fixed #3538 +* Fixed #3548 ## Release Candidate 31 (14 Mar 2022) https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#31 diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/SurvivalSlimefunGuide.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/SurvivalSlimefunGuide.java index 26c85ca3ed..00460151ba 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/SurvivalSlimefunGuide.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/SurvivalSlimefunGuide.java @@ -311,7 +311,7 @@ private void displaySlimefunItem(ChestMenu menu, ItemGroup itemGroup, Player p, try { if (isSurvivalMode()) { displayItem(profile, sfitem, true); - } else { + } else if (pl.hasPermission("slimefun.cheat.items")) { if (sfitem instanceof MultiBlockMachine) { Slimefun.getLocalization().sendMessage(pl, "guide.cheat.no-multiblocks"); } else { @@ -323,6 +323,13 @@ private void displaySlimefunItem(ChestMenu menu, ItemGroup itemGroup, Player p, pl.getInventory().addItem(clonedItem); } + } else { + /* + * Fixes #3548 - If for whatever reason, + * an unpermitted players gets access to this guide, + * this will be our last line of defense to prevent any exploit. + */ + Slimefun.getLocalization().sendMessage(pl, "messages.no-permission", true); } } catch (Exception | LinkageError x) { printErrorMessage(pl, x); From 227e62402280600c81b22bea4fd4fef7b35a2835 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 29 Apr 2022 12:23:39 +0200 Subject: [PATCH 27/34] [CI skip] Update actions/setup-java action to v3.2.0 --- .github/workflows/discord-webhook.yml | 2 +- .github/workflows/maven-compiler.yml | 2 +- .github/workflows/sonarcloud.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/discord-webhook.yml b/.github/workflows/discord-webhook.yml index a71c040609..873cfd685c 100644 --- a/.github/workflows/discord-webhook.yml +++ b/.github/workflows/discord-webhook.yml @@ -21,7 +21,7 @@ jobs: uses: actions/checkout@v3.0.2 - name: Set up Java JDK 17 - uses: actions/setup-java@v3.1.1 + uses: actions/setup-java@v3.2.0 with: distribution: 'adopt' java-version: '17' diff --git a/.github/workflows/maven-compiler.yml b/.github/workflows/maven-compiler.yml index a5743d9798..73e016172f 100644 --- a/.github/workflows/maven-compiler.yml +++ b/.github/workflows/maven-compiler.yml @@ -24,7 +24,7 @@ jobs: uses: actions/checkout@v3 - name: Set up JDK 17 - uses: actions/setup-java@v3.1.1 + uses: actions/setup-java@v3.2.0 with: distribution: 'adopt' java-version: '17' diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 2565e0f593..c0eaa3eb6d 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -21,7 +21,7 @@ jobs: fetch-depth: 0 - name: Set up JDK 17 - uses: actions/setup-java@v3.1.1 + uses: actions/setup-java@v3.2.0 with: distribution: 'adopt' java-version: '17' From 1097b5582ef9161f5720c3cca345fdca564523fb Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 29 Apr 2022 12:23:46 +0200 Subject: [PATCH 28/34] [CI skip] Update dependency com.gmail.nossr50.mcMMO:mcMMO to v2.1.212 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 084ba4c72d..fba88e1602 100644 --- a/pom.xml +++ b/pom.xml @@ -435,7 +435,7 @@ com.gmail.nossr50.mcMMO mcMMO - 2.1.211 + 2.1.212 provided From ecb4196dc4cd10677f0e7deec740015a732944bc Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Fri, 29 Apr 2022 12:25:44 +0200 Subject: [PATCH 29/34] [CI skip] Updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75c8375773..69fcb2dfe5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ * Added Organic Fertilizer for Seagrass #### Changes +* Removed support for ChestTerminal #### Fixes * Fixed #3445 From 949eb48fbc7f940a750d9da298a73e130bb9766f Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Fri, 29 Apr 2022 12:26:20 +0200 Subject: [PATCH 30/34] [CI skip] Removed CT as a loadbefore --- src/main/resources/plugin.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index c897863129..1215c74540 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -20,10 +20,6 @@ softdepend: - ItemsAdder - Orebfuscator -# We hook into these plugins too, but they depend on Slimefun. -loadBefore: -- ChestTerminal - # Our commands commands: slimefun: From bf7548c43afd6c7d2ed874c60de598e6976aa357 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 May 2022 11:31:07 +0000 Subject: [PATCH 31/34] =?UTF-8?q?=F0=9F=94=A7=20Bump=20maven-git-versionin?= =?UTF-8?q?g-extension=20from=207.4.0=20to=208.0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [maven-git-versioning-extension](https://github.com/qoomon/maven-git-versioning-extension) from 7.4.0 to 8.0.0. - [Release notes](https://github.com/qoomon/maven-git-versioning-extension/releases) - [Changelog](https://github.com/qoomon/maven-git-versioning-extension/blob/master/CHANGELOG.md) - [Commits](https://github.com/qoomon/maven-git-versioning-extension/commits) --- updated-dependencies: - dependency-name: me.qoomon:maven-git-versioning-extension dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .mvn/extensions.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml index 4275b46692..95ae9ed315 100644 --- a/.mvn/extensions.xml +++ b/.mvn/extensions.xml @@ -4,7 +4,7 @@ me.qoomon maven-git-versioning-extension - 7.4.0 + 8.0.0 \ No newline at end of file From ecb14c09913a717ffcb1350f997ca380869c0b88 Mon Sep 17 00:00:00 2001 From: StarWishsama Date: Wed, 11 May 2022 12:48:17 +0800 Subject: [PATCH 32/34] :pencil2: chores(trans): fix #538 --- .../implementation/items/multiblocks/PressureChamber.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/PressureChamber.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/PressureChamber.java index 7983b88690..a95d4cfe14 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/PressureChamber.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/PressureChamber.java @@ -29,7 +29,7 @@ public class PressureChamber extends MultiBlockMachine { @ParametersAreNonnullByDefault public PressureChamber(ItemGroup itemGroup, SlimefunItemStack item) { - super(itemGroup, item, new ItemStack[] { new ItemStack(Material.SMOOTH_STONE_SLAB), new CustomItemStack(Material.DISPENSER, "活塞 (朝下)"), new ItemStack(Material.SMOOTH_STONE_SLAB), new ItemStack(Material.PISTON), new ItemStack(Material.GLASS), new ItemStack(Material.PISTON), new ItemStack(Material.PISTON), new ItemStack(Material.CAULDRON), new ItemStack(Material.PISTON) }, BlockFace.UP); + super(itemGroup, item, new ItemStack[] { new ItemStack(Material.SMOOTH_STONE_SLAB), new CustomItemStack(Material.DISPENSER, "发射器 (朝下)"), new ItemStack(Material.SMOOTH_STONE_SLAB), new ItemStack(Material.PISTON), new ItemStack(Material.GLASS), new ItemStack(Material.PISTON), new ItemStack(Material.PISTON), new ItemStack(Material.CAULDRON), new ItemStack(Material.PISTON) }, BlockFace.UP); } @Override From 1d02506446c9786ead50e1185a2e7b07564a2fe3 Mon Sep 17 00:00:00 2001 From: ybw0014 Date: Wed, 11 May 2022 17:38:37 -0400 Subject: [PATCH 33/34] chore(jitpack): Configure jitpack --- jitpack.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 jitpack.yml diff --git a/jitpack.yml b/jitpack.yml new file mode 100644 index 0000000000..3b7f6623ef --- /dev/null +++ b/jitpack.yml @@ -0,0 +1,3 @@ +before_install: + - wget https://github.com/sormuras/bach/raw/master/install-jdk.sh + - source ./install-jdk.sh --feature 17 --license GPL From 0816d8581ab96e897984c145e950c745f09b849b Mon Sep 17 00:00:00 2001 From: ybw0014 Date: Wed, 11 May 2022 17:42:09 -0400 Subject: [PATCH 34/34] chore(jitpack): reformat --- jitpack.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jitpack.yml b/jitpack.yml index 3b7f6623ef..b171d12e83 100644 --- a/jitpack.yml +++ b/jitpack.yml @@ -1,3 +1,3 @@ before_install: - - wget https://github.com/sormuras/bach/raw/master/install-jdk.sh + - wget https://github.com/sormuras/bach/raw/master/install-jdk.sh - source ./install-jdk.sh --feature 17 --license GPL