diff --git a/.github/configs/yaml-linter.yml b/.github/configs/yaml-linter.yml
index 90060a83c..3f056f2a1 100644
--- a/.github/configs/yaml-linter.yml
+++ b/.github/configs/yaml-linter.yml
@@ -6,10 +6,13 @@ yaml-files:
rules:
- ## A warning is sufficient here
- line-length:
- max: 180
- level: warning
+ ## Don't warn for line lengths
+ line-length: disable
+
+ truthy:
+ allowed-values: ['true', 'false']
+ ## We don't want it to trigger for the 'on' in our workflows
+ check-keys: false
## We don't need indentation warnings
indentation: disable
diff --git a/.github/workflows/discord-webhook.yml b/.github/workflows/discord-webhook.yml
index a4845bb6f..d6edc5e08 100644
--- a/.github/workflows/discord-webhook.yml
+++ b/.github/workflows/discord-webhook.yml
@@ -16,7 +16,7 @@ jobs:
steps:
- name: Checkout repository
- uses: actions/checkout@v2.3.3
+ uses: actions/checkout@v2.3.4
- name: Set up Java JDK 11
uses: actions/setup-java@v1.4.3
with:
diff --git a/.github/workflows/maven-compiler.yml b/.github/workflows/maven-compiler.yml
index 1e041876b..9b02b166c 100644
--- a/.github/workflows/maven-compiler.yml
+++ b/.github/workflows/maven-compiler.yml
@@ -22,7 +22,7 @@ jobs:
steps:
- name: Checkout repository
- uses: actions/checkout@v1
+ uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@master
with:
diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml
index 20e965f91..d9c720087 100644
--- a/.github/workflows/update-changelog.yml
+++ b/.github/workflows/update-changelog.yml
@@ -16,7 +16,7 @@ jobs:
steps:
- name: TOC Generator
- uses: technote-space/toc-generator@v2.4.0
+ uses: technote-space/toc-generator@v2.6.1
with:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
TARGET_PATHS: 'CHANGELOG.md'
diff --git a/.github/workflows/url-checker.yml b/.github/workflows/url-checker.yml
index 523248f00..42483c750 100644
--- a/.github/workflows/url-checker.yml
+++ b/.github/workflows/url-checker.yml
@@ -6,7 +6,7 @@ on:
- master
jobs:
- build:
+ check:
name: URL Checker
runs-on: ubuntu-latest
@@ -17,7 +17,7 @@ jobs:
with:
git_path: https://github.com/Slimefun/Slimefun4
file_types: .md,.java,.yml
- print_all: False
+ print_all: false
retry_count: 2
## These URLs will always be correct, even if their services may be offline right now
white_listed_patterns: http://textures.minecraft.net/texture/,https://pastebin.com/,https://www.spigotmc.org/threads/spigot-bungeecord-1-16-1.447405/#post-3852349,https://gitlocalize.com/repo/3841
diff --git a/.github/workflows/yaml-linter.yml b/.github/workflows/yaml-linter.yml
index 00f94e27c..55d01153f 100644
--- a/.github/workflows/yaml-linter.yml
+++ b/.github/workflows/yaml-linter.yml
@@ -16,8 +16,8 @@ jobs:
steps:
- name: Checkout repository
- uses: actions/checkout@v1
+ uses: actions/checkout@v2
- name: YAML Linter
- uses: ibiqlik/action-yamllint@v1.0.0
+ uses: ibiqlik/action-yamllint@v3.0.0
with:
config_file: '.github/configs/yaml-linter.yml'
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e3f22799e..2e0473ab3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,11 +26,39 @@
## Release Candidate 18 (TBD)
#### Additions
+* The Smelters Pick now also works on Ancient Debris
+* (API) Added PlayerPreResearchEvent
+* Added a config option to disable network visualizations
+* (API) Added CoolerFeedPlayerEvent
#### Changes
* Removed 1.13 support
+* Cooling Units can no longer be placed down
+* Heating Coils can no longer be placed down
+* Electric Motors can no longer be placed down
+* Cargo Motors can no longer be placed down
+* Magnets can no longer be placed down
+* Electromagnets can no longer be placed down
+* Performance improvements to Cargo network visualizations
#### Fixes
+* Fixed #2448
+* Fixed #2470
+* Fixed #2478
+* Fixed #2493
+* Fixed a missing slot in the contributors menu
+* Fixed color codes in script downloading screen
+* Fixed #2505
+* Fixed contributors not showing correctly
+* Fixed #2469
+* Fixed #2509
+* Fixed #2499
+* Fixed #2527
+* Fixed #2519
+* Fixed #2517
+* Fixed Magician Talisman sometimes drawing invalid enchantments
+* Fixed id conflicts for external Enchantment sources (e.g. plugins) for the Magician Talisman settings
+* Fixed network visualizers spawning particles for other player heads
## Release Candidate 17 (17 Oct 2020)
diff --git a/README.md b/README.md
index f531b510d..a80303a5e 100644
--- a/README.md
+++ b/README.md
@@ -67,7 +67,7 @@ Well, we asked some users on our [Discord server](#discord) to send us some scre
| *Screenshot provided by GalaxyKat11#3816* | *Screenshot provided by TamThan#7987* | *Screenshot provided by Kilaruna#4981* |
## Discord
-You can find Slimefun's community on Discord and connect with **over 2500** users of this plugin from all over the world.
+You can find Slimefun's community on Discord and connect with **over 3000** users of this plugin from all over the world.
Click the badge down below to join the server for suggestions/questions or other discussions about this plugin.
We are also hosting a community event every so often, join us to find out more.
**Important**: We do **not** accept bug reports on discord, please use our [Issue Tracker](https://github.com/Slimefun/Slimefun4/issues) to submit bug reports!
diff --git a/pom.xml b/pom.xml
index 06d6812a0..1d4321fc8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
1.8
- 1.16.3
+ 1.16.4
https://hub.spigotmc.org/javadocs/spigot/
@@ -315,7 +315,7 @@
com.github.seeseemelk
MockBukkit-v1.16
- 0.13.0
+ 0.15.0
test
@@ -329,7 +329,7 @@
org.mockito
mockito-core
- 3.5.13
+ 3.6.0
test
@@ -349,7 +349,7 @@
com.konghq
unirest-java
- 3.11.01
+ 3.11.05
compile
@@ -363,7 +363,7 @@
com.sk89q.worldedit
worldedit-bukkit
- 7.2.0-SNAPSHOT
+ 7.2.0
provided
@@ -381,7 +381,7 @@
com.gmail.nossr50.mcMMO
mcMMO
- 2.1.149
+ 2.1.154
provided
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/CoolerFeedPlayerEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/CoolerFeedPlayerEvent.java
new file mode 100644
index 000000000..b6a3d579c
--- /dev/null
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/CoolerFeedPlayerEvent.java
@@ -0,0 +1,113 @@
+package io.github.thebusybiscuit.slimefun4.api.events;
+
+import javax.annotation.Nonnull;
+import javax.annotation.ParametersAreNonnullByDefault;
+
+import org.apache.commons.lang.Validate;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.PotionMeta;
+import org.bukkit.potion.PotionEffect;
+
+import io.github.thebusybiscuit.slimefun4.implementation.items.backpacks.Cooler;
+
+/**
+ * This {@link Event} is called whenever a {@link Player} is
+ * fed through a {@link Cooler}.
+ *
+ * @author TheBusyBiscuit
+ *
+ * @see Cooler
+ *
+ */
+public class CoolerFeedPlayerEvent extends PlayerEvent implements Cancellable {
+
+ private static final HandlerList handlers = new HandlerList();
+
+ private final Cooler cooler;
+ private final ItemStack coolerItem;
+
+ private ItemStack consumedItem;
+ private boolean cancelled;
+
+ @ParametersAreNonnullByDefault
+ public CoolerFeedPlayerEvent(Player player, Cooler cooler, ItemStack coolerItem, ItemStack consumedItem) {
+ super(player);
+
+ this.cooler = cooler;
+ this.coolerItem = coolerItem;
+ this.consumedItem = consumedItem;
+ }
+
+ /**
+ * This returns the {@link Cooler} that was used.
+ *
+ * @return The {@link Cooler} that was used
+ */
+ @Nonnull
+ public Cooler getCooler() {
+ return cooler;
+ }
+
+ /**
+ * This returns the {@link Cooler} that was used (as an {@link ItemStack})
+ *
+ * @return The {@link Cooler} that was used
+ */
+ @Nonnull
+ public ItemStack getCoolerItem() {
+ return coolerItem;
+ }
+
+ /**
+ * This returns the {@link ItemStack} that was consumed.
+ * The returned {@link ItemStack} is immutable.
+ *
+ * @return The {@link ItemStack} that was consumed
+ */
+ @Nonnull
+ public ItemStack getConsumedItem() {
+ return consumedItem.clone();
+ }
+
+ /**
+ * This sets the {@link ItemStack} that should be "consumed".
+ * The {@link ItemStack} must be a potion.
+ * The {@link Player} will receive the {@link PotionEffect PotionEffects} of the
+ * provided potion upon consumption.
+ *
+ * @param item
+ * The new {@link ItemStack}
+ */
+ public void setConsumedItem(@Nonnull ItemStack item) {
+ Validate.notNull(item, "The consumed Item cannot be null!");
+ Validate.isTrue(item.getItemMeta() instanceof PotionMeta, "The item must be a potion!");
+
+ this.consumedItem = item;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancelled = cancel;
+ }
+
+ @Nonnull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Nonnull
+ @Override
+ public HandlerList getHandlers() {
+ return getHandlerList();
+ }
+}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/PlayerPreResearchEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/PlayerPreResearchEvent.java
new file mode 100644
index 000000000..12282bda7
--- /dev/null
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/PlayerPreResearchEvent.java
@@ -0,0 +1,83 @@
+package io.github.thebusybiscuit.slimefun4.api.events;
+
+import javax.annotation.Nonnull;
+import javax.annotation.ParametersAreNonnullByDefault;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.apache.commons.lang.Validate;
+import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.core.researching.Research;
+import io.github.thebusybiscuit.slimefun4.implementation.guide.BookSlimefunGuide;
+import io.github.thebusybiscuit.slimefun4.implementation.guide.ChestSlimefunGuide;
+import io.github.thebusybiscuit.slimefun4.implementation.guide.CheatSheetSlimefunGuide;
+
+/**
+ * This {@link Event} is called whenever a {@link Player} clicks to unlock a {@link Research}.
+ * This is called before {@link Research#canUnlock(Player)}.
+ * The {@link Event} is not called for {@link CheatSheetSlimefunGuide}.
+ *
+ * @author uiytt
+ *
+ * @see ChestSlimefunGuide
+ * @see BookSlimefunGuide
+ *
+ */
+public class PlayerPreResearchEvent extends Event implements Cancellable {
+
+ private static final HandlerList handlers = new HandlerList();
+
+ private final Player player;
+ private final Research research;
+ private final SlimefunItem slimefunItem;
+ private boolean cancelled;
+
+ @ParametersAreNonnullByDefault
+ public PlayerPreResearchEvent(Player p, Research research, SlimefunItem slimefunItem) {
+ Validate.notNull(p, "The Player cannot be null");
+ Validate.notNull(research, "Research cannot be null");
+ Validate.notNull(slimefunItem, "SlimefunItem cannot be null");
+
+ this.player = p;
+ this.research = research;
+ this.slimefunItem = slimefunItem;
+ }
+
+ @Nonnull
+ public Player getPlayer() {
+ return player;
+ }
+
+ @Nonnull
+ public Research getResearch() {
+ return research;
+ }
+
+ @Nonnull
+ public SlimefunItem getSlimefunItem() {
+ return slimefunItem;
+ }
+
+ @Nonnull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Nonnull
+ @Override
+ public HandlerList getHandlers() {
+ return getHandlerList();
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancelled) {
+ this.cancelled = cancelled;
+ }
+}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/Network.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/Network.java
index f058941b3..e4d06619e 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/Network.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/Network.java
@@ -9,11 +9,8 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.apache.commons.lang.Validate;
-import org.bukkit.Color;
import org.bukkit.Location;
-import org.bukkit.Material;
import org.bukkit.Particle;
-import org.bukkit.Particle.DustOptions;
import io.github.thebusybiscuit.slimefun4.core.networks.NetworkManager;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
@@ -103,13 +100,16 @@ public abstract class Network {
return regulatorNodes.size() + connectorNodes.size() + terminusNodes.size();
}
+ /**
+ * This method adds the given {@link Location} to this {@link Network}.
+ *
+ * @param l
+ * The {@link Location} to add
+ */
protected void addLocationToNetwork(@Nonnull Location l) {
- if (connectedLocations.contains(l)) {
- return;
+ if (connectedLocations.add(l.clone())) {
+ markDirty(l);
}
-
- connectedLocations.add(l.clone());
- markDirty(l);
}
/**
@@ -211,17 +211,9 @@ public abstract class Network {
* every {@link Location} that this {@link Network} is connected to.
*/
public void display() {
- SlimefunPlugin.runSync(() -> {
- DustOptions options = new DustOptions(Color.BLUE, 3F);
-
- for (Location l : connectedLocations) {
- Material type = l.getBlock().getType();
-
- if (type == Material.PLAYER_HEAD || type == Material.PLAYER_WALL_HEAD) {
- l.getWorld().spawnParticle(Particle.REDSTONE, l.getX() + 0.5, l.getY() + 0.5, l.getZ() + 0.5, 1, 0, 0, 0, 1, options);
- }
- }
- });
+ if (manager.isVisualizerEnabled()) {
+ SlimefunPlugin.runSync(new NetworkVisualizer(this));
+ }
}
/**
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/NetworkVisualizer.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/NetworkVisualizer.java
new file mode 100644
index 000000000..7933c51ab
--- /dev/null
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/NetworkVisualizer.java
@@ -0,0 +1,59 @@
+package io.github.thebusybiscuit.slimefun4.api.network;
+
+import javax.annotation.Nonnull;
+
+import org.bukkit.Color;
+import org.bukkit.Location;
+import org.bukkit.Particle;
+import org.bukkit.Particle.DustOptions;
+
+/**
+ * This class represents the visualizer task of a given {@link Network}.
+ *
+ * @author TheBusyBiscuit
+ *
+ */
+class NetworkVisualizer implements Runnable {
+
+ /**
+ * The {@link DustOptions} define the {@link Color} and size of our particles.
+ */
+ private final DustOptions options = new DustOptions(Color.BLUE, 3.5F);
+
+ /**
+ * This is our {@link Network} instance.
+ */
+ private final Network network;
+
+ /**
+ * This creates a new {@link NetworkVisualizer} for the given {@link Network}.
+ *
+ * @param network
+ * The {@link Network} to visualize
+ */
+ NetworkVisualizer(@Nonnull Network network) {
+ this.network = network;
+ }
+
+ @Override
+ public void run() {
+ for (Location l : network.connectorNodes) {
+ spawnParticles(l);
+ }
+
+ for (Location l : network.terminusNodes) {
+ spawnParticles(l);
+ }
+ }
+
+ /**
+ * This method will spawn the actual particles.
+ *
+ * @param l
+ * The {@link Location} of our node
+ */
+ private void spawnParticles(@Nonnull Location l) {
+ l.getWorld().spawnParticle(Particle.REDSTONE, l.getX() + 0.5, l.getY() + 0.5, l.getZ() + 0.5, 1, 0, 0, 0, 1, options);
+ }
+
+}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/GiveCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/GiveCommand.java
index 64c741ca1..dc3e4f00d 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/GiveCommand.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/GiveCommand.java
@@ -40,7 +40,7 @@ class GiveCommand extends SubCommand {
if (sfItem != null) {
giveItem(sender, p, sfItem, args);
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.not-valid-item", true, msg -> msg.replace(PLACEHOLDER_ITEM, args[2]));
+ SlimefunPlugin.getLocalization().sendMessage(sender, "messages.invalid-item", true, msg -> msg.replace(PLACEHOLDER_ITEM, args[2]));
}
} else {
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.not-online", true, msg -> msg.replace(PLACEHOLDER_PLAYER, args[1]));
@@ -70,7 +70,7 @@ class GiveCommand extends SubCommand {
SlimefunPlugin.getLocalization().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.getLocalization().sendMessage(sender, "messages.not-valid-amount", true, msg -> msg.replace(PLACEHOLDER_AMOUNT, args[3]));
+ SlimefunPlugin.getLocalization().sendMessage(sender, "messages.invalid-amount", true, msg -> msg.replace(PLACEHOLDER_AMOUNT, args[3]));
}
}
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ResearchCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ResearchCommand.java
index 8bc1d7e2d..9c3d29889 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ResearchCommand.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ResearchCommand.java
@@ -66,7 +66,7 @@ class ResearchCommand extends SubCommand {
SlimefunPlugin.getLocalization().sendMessage(player, "messages.give-research", true, variables);
});
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.not-valid-research", true, msg -> msg.replace(PLACEHOLDER_RESEARCH, input));
+ SlimefunPlugin.getLocalization().sendMessage(sender, "messages.invalid-research", true, msg -> msg.replace(PLACEHOLDER_RESEARCH, input));
}
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/ContributorsMenu.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/ContributorsMenu.java
index df5d74cf0..5ed9c6918 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/ContributorsMenu.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/ContributorsMenu.java
@@ -37,7 +37,7 @@ final class ContributorsMenu {
menu.setEmptySlotsClickable(false);
menu.addMenuOpeningHandler(pl -> pl.playSound(pl.getLocation(), Sound.BLOCK_NOTE_BLOCK_HARP, 0.7F, 0.7F));
- ChestMenuUtils.drawBackground(menu, 0, 2, 3, 4, 5, 6, 7, 8, 45, 47, 48, 49, 50, 51, 52);
+ ChestMenuUtils.drawBackground(menu, 0, 2, 3, 4, 5, 6, 7, 8, 45, 47, 48, 49, 50, 51, 53);
menu.addItem(1, new CustomItem(ChestMenuUtils.getBackButton(p, "", "&7" + SlimefunPlugin.getLocalization().getMessage(p, "guide.back.settings"))));
menu.addMenuClickHandler(1, (pl, slot, item, action) -> {
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/RainbowTickHandler.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/RainbowTickHandler.java
index 4ba7ed63a..bcd5f0ac8 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/RainbowTickHandler.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/RainbowTickHandler.java
@@ -16,6 +16,7 @@ import io.github.thebusybiscuit.cscorelib2.collections.LoopIterator;
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.items.blocks.RainbowBlock;
+import io.github.thebusybiscuit.slimefun4.utils.ColoredMaterial;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.Objects.handlers.BlockTicker;
@@ -48,10 +49,14 @@ public class RainbowTickHandler extends BlockTicker {
material = iterator.next();
}
- public RainbowTickHandler(Material... materials) {
+ public RainbowTickHandler(@Nonnull Material... materials) {
this(Arrays.asList(materials));
}
+ public RainbowTickHandler(@Nonnull ColoredMaterial material) {
+ this(material.asList());
+ }
+
/**
* This method checks whether a given {@link Material} array contains any {@link Material}
* that would result in a {@link GlassPane} {@link BlockData}.
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/NetworkManager.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/NetworkManager.java
index 0d0b80f0a..a7c4089a8 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/NetworkManager.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/NetworkManager.java
@@ -29,6 +29,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.listeners.NetworkListen
public class NetworkManager {
private final int maxNodes;
+ private final boolean enableVisualizer;
private final List networks = new LinkedList<>();
/**
@@ -37,8 +38,10 @@ public class NetworkManager {
* @param maxStepSize
* The maximum amount of nodes a {@link Network} can have
*/
- public NetworkManager(int maxStepSize) {
+ public NetworkManager(int maxStepSize, boolean enableVisualizer) {
Validate.isTrue(maxStepSize > 0, "The maximal Network size must be above zero!");
+
+ this.enableVisualizer = enableVisualizer;
maxNodes = maxStepSize;
}
@@ -52,6 +55,15 @@ public class NetworkManager {
return maxNodes;
}
+ /**
+ * This returns whether the {@link Network} visualizer is enabled.
+ *
+ * @return Whether the {@link Network} visualizer is enabled
+ */
+ public boolean isVisualizerEnabled() {
+ return enableVisualizer;
+ }
+
/**
* This returns a {@link List} of every {@link Network} on the {@link Server}.
*
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/researching/Research.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/researching/Research.java
index 03784dd50..569845ac4 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/researching/Research.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/researching/Research.java
@@ -8,6 +8,7 @@ import java.util.function.Consumer;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import javax.annotation.ParametersAreNonnullByDefault;
import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
@@ -25,6 +26,9 @@ import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.setup.ResearchSetup;
import io.github.thebusybiscuit.slimefun4.utils.FireworkUtils;
+import io.github.thebusybiscuit.slimefun4.api.events.PlayerPreResearchEvent;
+import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideImplementation;
+import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
/**
@@ -189,6 +193,38 @@ public class Research implements Keyed {
return items;
}
+ /**
+ * Handle what to do when a {@link Player} clicks on an un-researched item in
+ * a {@link SlimefunGuideImplementation}.
+ *
+ * @param guide The {@link SlimefunGuideImplementation} used.
+ * @param player The {@link Player} who clicked on the item.
+ * @param profile The {@link PlayerProfile} of that {@link Player}.
+ * @param sfItem The {@link SlimefunItem} on which the {@link Player} clicked.
+ * @param category The {@link Category} where the {@link Player} was.
+ * @param page The page number of where the {@link Player} was in the {@link Category};
+ *
+ */
+ @ParametersAreNonnullByDefault
+ public void unlockFromGuide(SlimefunGuideImplementation guide, Player player, PlayerProfile profile, SlimefunItem sfItem, Category category, int page) {
+ if (!SlimefunPlugin.getRegistry().getCurrentlyResearchingPlayers().contains(player.getUniqueId())) {
+ if (profile.hasUnlocked(this)) {
+ guide.openCategory(profile, category, page);
+ } else {
+ PlayerPreResearchEvent event = new PlayerPreResearchEvent(player, this, sfItem);
+ Bukkit.getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ if (this.canUnlock(player)) {
+ guide.unlockItem(player, sfItem, pl -> guide.openCategory(profile, category, page));
+ } else {
+ SlimefunPlugin.getLocalization().sendMessage(player, "messages.not-enough-xp", true);
+ }
+ }
+ }
+ }
+ }
+
/**
* Checks if the {@link Player} can unlock this {@link Research}.
*
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BlockDataService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BlockDataService.java
index c9c577681..98a8b2853 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BlockDataService.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BlockDataService.java
@@ -1,16 +1,31 @@
package io.github.thebusybiscuit.slimefun4.core.services;
import java.util.Optional;
+import java.util.logging.Level;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import org.apache.commons.lang.Validate;
+
+import org.bukkit.Bukkit;
import org.bukkit.Keyed;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.TileState;
+import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.persistence.PersistentDataHolder;
+import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.Plugin;
+import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
+import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.papermc.lib.PaperLib;
+import io.papermc.lib.features.blockstatesnapshot.BlockStateSnapshotResult;
+import me.mrCookieSlime.Slimefun.api.Slimefun;
+
/**
* The {@link BlockDataService} is similar to the {@link CustomItemDataService},
* it is responsible for storing NBT data inside a {@link TileState}.
@@ -20,11 +35,21 @@ import org.bukkit.plugin.Plugin;
* @author TheBusyBiscuit
*
*/
-public class BlockDataService implements PersistentDataService, Keyed {
+public class BlockDataService implements Keyed {
private final NamespacedKey namespacedKey;
- public BlockDataService(Plugin plugin, String key) {
+ /**
+ * This creates a new {@link BlockDataService} for the given {@link Plugin}.
+ * The {@link Plugin} and key will together form a {@link NamespacedKey} used to store
+ * data on a {@link TileState}.
+ *
+ * @param plugin
+ * The {@link Plugin} responsible for this service
+ * @param key
+ * The key under which to store data
+ */
+ public BlockDataService(@Nonnull Plugin plugin, @Nonnull String key) {
namespacedKey = new NamespacedKey(plugin, key);
}
@@ -41,12 +66,32 @@ public class BlockDataService implements PersistentDataService, Keyed {
* @param value
* The value to store
*/
- public void setBlockData(Block b, String value) {
- BlockState state = b.getState();
+ public void setBlockData(@Nonnull Block b, @Nonnull String value) {
+ Validate.notNull(b, "The block cannot be null!");
+ Validate.notNull(value, "The value cannot be null!");
+
+ // Due to a bug on older versions, Persistent Data is nullable for non-snapshots
+ boolean useSnapshot = SlimefunPlugin.getMinecraftVersion().isBefore(MinecraftVersion.MINECRAFT_1_16);
+
+ BlockStateSnapshotResult result = PaperLib.getBlockState(b, useSnapshot);
+ BlockState state = result.getState();
if (state instanceof TileState) {
- setString((TileState) state, namespacedKey, value);
- state.update();
+ try {
+ PersistentDataContainer container = ((TileState) state).getPersistentDataContainer();
+ container.set(namespacedKey, PersistentDataType.STRING, value);
+
+ if (result.isSnapshot()) {
+ state.update();
+ }
+ } catch (Exception x) {
+ Slimefun.getLogger().log(Level.SEVERE, "Please check if your Server Software is up to date!");
+
+ String serverSoftware = PaperLib.isSpigot() && !PaperLib.isPaper() ? "Spigot" : Bukkit.getName();
+ Slimefun.getLogger().log(Level.SEVERE, () -> serverSoftware + " | " + Bukkit.getVersion() + " | " + Bukkit.getBukkitVersion());
+
+ Slimefun.getLogger().log(Level.SEVERE, "An Exception was thrown while trying to set Persistent Data for a Block", x);
+ }
}
}
@@ -57,11 +102,14 @@ public class BlockDataService implements PersistentDataService, Keyed {
* The {@link Block} to retrieve data from
* @return The stored value
*/
- public Optional getBlockData(Block b) {
- BlockState state = b.getState();
+ public Optional getBlockData(@Nonnull Block b) {
+ Validate.notNull(b, "The block cannot be null!");
+
+ BlockState state = PaperLib.getBlockState(b, false).getState();
if (state instanceof TileState) {
- return getString((TileState) state, namespacedKey);
+ PersistentDataContainer container = ((TileState) state).getPersistentDataContainer();
+ return Optional.ofNullable(container.get(namespacedKey, PersistentDataType.STRING));
} else {
return Optional.empty();
}
@@ -77,9 +125,10 @@ public class BlockDataService implements PersistentDataService, Keyed {
*
* @param type
* The {@link Material} to check for
+ *
* @return Whether the given {@link Material} is considered a Tile Entity
*/
- public boolean isTileEntity(Material type) {
+ public boolean isTileEntity(@Nullable Material type) {
if (type == null || type.isAir()) {
// Cannot store data on air
return false;
@@ -104,10 +153,12 @@ public class BlockDataService implements PersistentDataService, Keyed {
case BARREL:
case SPAWNER:
case BEACON:
+ // All of the above Materials are Tile Entities
return true;
default:
+ // Otherwise we assume they're not Tile Entities
return false;
}
}
-}
+}
\ No newline at end of file
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/CustomItemDataService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/CustomItemDataService.java
index b2ca07a7c..6100fb821 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/CustomItemDataService.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/CustomItemDataService.java
@@ -2,11 +2,17 @@ package io.github.thebusybiscuit.slimefun4.core.services;
import java.util.Optional;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import org.apache.commons.lang.Validate;
import org.bukkit.Keyed;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
+import org.bukkit.persistence.PersistentDataContainer;
+import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.Plugin;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
@@ -22,7 +28,7 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
* @see SlimefunItemStack
*
*/
-public class CustomItemDataService implements PersistentDataService, Keyed {
+public class CustomItemDataService implements Keyed {
private final NamespacedKey namespacedKey;
@@ -35,7 +41,7 @@ public class CustomItemDataService implements PersistentDataService, Keyed {
* @param key
* The key under which to store data
*/
- public CustomItemDataService(Plugin plugin, String key) {
+ public CustomItemDataService(@Nonnull Plugin plugin, @Nonnull String key) {
// Null-Validation is performed in the NamespacedKey constructor
namespacedKey = new NamespacedKey(plugin, key);
}
@@ -45,14 +51,39 @@ public class CustomItemDataService implements PersistentDataService, Keyed {
return namespacedKey;
}
- public void setItemData(ItemStack item, String id) {
+ /**
+ * This method stores the given id on the provided {@link ItemStack} via
+ * persistent data.
+ *
+ * @param item
+ * The {@link ItemStack} to store data on
+ * @param id
+ * The id to store on the {@link ItemStack}
+ */
+ public void setItemData(@Nonnull ItemStack item, @Nonnull String id) {
+ Validate.notNull(item, "The Item cannot be null!");
+ Validate.notNull(id, "Cannot store null on an Item!");
+
ItemMeta im = item.getItemMeta();
setItemData(im, id);
item.setItemMeta(im);
}
- public void setItemData(ItemMeta im, String id) {
- setString(im, namespacedKey, id);
+ /**
+ * This method stores the given id on the provided {@link ItemMeta} via
+ * persistent data.
+ *
+ * @param meta
+ * The {@link ItemMeta} to store data on
+ * @param id
+ * The id to store on the {@link ItemMeta}
+ */
+ public void setItemData(@Nonnull ItemMeta meta, @Nonnull String id) {
+ Validate.notNull(meta, "The ItemMeta cannot be null!");
+ Validate.notNull(id, "Cannot store null on an ItemMeta!");
+
+ PersistentDataContainer container = meta.getPersistentDataContainer();
+ container.set(namespacedKey, PersistentDataType.STRING, id);
}
/**
@@ -65,7 +96,8 @@ public class CustomItemDataService implements PersistentDataService, Keyed {
*
* @return An {@link Optional} describing the result
*/
- public Optional getItemData(ItemStack item) {
+ @Nonnull
+ public Optional getItemData(@Nullable ItemStack item) {
if (item == null || item.getType() == Material.AIR || !item.hasItemMeta()) {
return Optional.empty();
}
@@ -82,8 +114,12 @@ public class CustomItemDataService implements PersistentDataService, Keyed {
*
* @return An {@link Optional} describing the result
*/
- public Optional getItemData(ItemMeta meta) {
- return getString(meta, namespacedKey);
+ @Nonnull
+ public Optional getItemData(@Nonnull ItemMeta meta) {
+ Validate.notNull(meta, "Cannot read data from null!");
+
+ PersistentDataContainer container = meta.getPersistentDataContainer();
+ return Optional.ofNullable(container.get(namespacedKey, PersistentDataType.STRING));
}
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/CustomTextureService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/CustomTextureService.java
index 5587ad8b2..3caea1cbb 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/CustomTextureService.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/CustomTextureService.java
@@ -28,6 +28,12 @@ public class CustomTextureService {
private String version = null;
private boolean modified = false;
+ /**
+ * This creates a new {@link CustomTextureService} for the provided {@link Config}
+ *
+ * @param config
+ * The {@link Config} to read custom model data from
+ */
public CustomTextureService(@Nonnull Config config) {
this.config = config;
config.getConfiguration().options().header("This file is used to assign items from Slimefun or any of its addons\n" + "the 'CustomModelData' NBT tag. This can be used in conjunction with a custom resource pack\n" + "to give items custom textures.\n0 means there is no data assigned to that item.\n\n" + "There is no official Slimefun resource pack at the moment.");
@@ -49,6 +55,8 @@ public class CustomTextureService {
config.setDefaultValue("SLIMEFUN_GUIDE", 0);
config.setDefaultValue("_UI_BACKGROUND", 0);
+ config.setDefaultValue("_UI_NO_PERMISSION", 0);
+ config.setDefaultValue("_UI_NOT_RESEARCHED", 0);
config.setDefaultValue("_UI_INPUT_SLOT", 0);
config.setDefaultValue("_UI_OUTPUT_SLOT", 0);
config.setDefaultValue("_UI_BACK", 0);
@@ -82,22 +90,60 @@ public class CustomTextureService {
return version;
}
+ /**
+ * This returns true if any custom model data was configured.
+ * If every item id has no configured custom model data, it will return false.
+ *
+ * @return Whether any custom model data was configured
+ */
public boolean isActive() {
return modified;
}
+ /**
+ * This returns the configured custom model data for a given id.
+ *
+ * @param id
+ * The id to get the data for
+ *
+ * @return The configured custom model data
+ */
public int getModelData(@Nonnull String id) {
Validate.notNull(id, "Cannot get the ModelData for 'null'");
return config.getInt(id);
}
+ /**
+ * This method sets the custom model data for this {@link ItemStack}
+ * to the value configured for the provided item id.
+ *
+ * @param item
+ * The {@link ItemStack} to set the custom model data for
+ * @param id
+ * The id for which to get the configured model data
+ */
public void setTexture(@Nonnull ItemStack item, @Nonnull String id) {
+ Validate.notNull(item, "The Item cannot be null!");
+ Validate.notNull(id, "Cannot store null on an Item!");
+
ItemMeta im = item.getItemMeta();
setTexture(im, id);
item.setItemMeta(im);
}
+ /**
+ * This method sets the custom model data for this {@link ItemMeta}
+ * to the value configured for the provided item id.
+ *
+ * @param im
+ * The {@link ItemMeta} to set the custom model data for
+ * @param id
+ * The id for which to get the configured model data
+ */
public void setTexture(@Nonnull ItemMeta im, @Nonnull String id) {
+ Validate.notNull(im, "The ItemMeta cannot be null!");
+ Validate.notNull(id, "Cannot store null on an ItemMeta!");
+
int data = getModelData(id);
im.setCustomModelData(data == 0 ? null : data);
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/LocalizationService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/LocalizationService.java
index d790144c4..f14fe320b 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/LocalizationService.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/LocalizationService.java
@@ -8,7 +8,6 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
-import java.util.Optional;
import java.util.Set;
import java.util.logging.Level;
@@ -21,6 +20,8 @@ import org.bukkit.Server;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
+import org.bukkit.persistence.PersistentDataContainer;
+import org.bukkit.persistence.PersistentDataType;
import io.github.thebusybiscuit.cscorelib2.math.DoubleHandler;
import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
@@ -37,7 +38,7 @@ import me.mrCookieSlime.Slimefun.api.Slimefun;
* @see Language
*
*/
-public class LocalizationService extends SlimefunLocalization implements PersistentDataService {
+public class LocalizationService extends SlimefunLocalization {
private static final String LANGUAGE_PATH = "language";
@@ -151,10 +152,12 @@ public class LocalizationService extends SlimefunLocalization implements Persist
@Override
public Language getLanguage(@Nonnull Player p) {
Validate.notNull("Player cannot be null!");
- Optional language = getString(p, languageKey);
- if (language.isPresent()) {
- Language lang = languages.get(language.get());
+ PersistentDataContainer container = p.getPersistentDataContainer();
+ String language = container.get(languageKey, PersistentDataType.STRING);
+
+ if (language != null) {
+ Language lang = languages.get(language);
if (lang != null) {
return lang;
@@ -164,7 +167,7 @@ public class LocalizationService extends SlimefunLocalization implements Persist
return getDefaultLanguage();
}
- private void setLanguage(String language, boolean reset) {
+ private void setLanguage(@Nonnull String language, boolean reset) {
// Clearing out the old Language (if necessary)
if (reset) {
getConfig().clear();
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/MetricsService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/MetricsService.java
index 5835e9f86..74ddcd2e1 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/MetricsService.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/MetricsService.java
@@ -34,9 +34,26 @@ import kong.unirest.UnirestException;
*/
public class MetricsService {
+ /**
+ * The URL pointing towards the GitHub API.
+ */
private static final String API_URL = "https://api.github.com/";
+
+ /**
+ * The Name of our repository
+ */
private static final String REPO_NAME = "MetricsModule";
+
+ /**
+ * The URL pointing towards the /releases/ endpoint of our
+ * Metrics repository
+ */
private static final String RELEASES_URL = API_URL + "repos/Slimefun/" + REPO_NAME + "/releases/latest";
+
+ /**
+ * The URL pointing towards the download location for a
+ * GitHub release of our Metrics repository
+ */
private static final String DOWNLOAD_URL = "https://github.com/Slimefun/" + REPO_NAME + "/releases/download";
private final SlimefunPlugin plugin;
@@ -48,9 +65,22 @@ public class MetricsService {
private boolean hasDownloadedUpdate = false;
static {
- Unirest.config().concurrency(2, 1).setDefaultHeader("User-Agent", "MetricsModule Auto-Updater").setDefaultHeader("Accept", "application/vnd.github.v3+json").enableCookieManagement(false).cookieSpec("ignoreCookies");
+ // @formatter:off (We want this to stay this nicely aligned :D )
+ Unirest.config()
+ .concurrency(2, 1)
+ .setDefaultHeader("User-Agent", "MetricsModule Auto-Updater")
+ .setDefaultHeader("Accept", "application/vnd.github.v3+json")
+ .enableCookieManagement(false)
+ .cookieSpec("ignoreCookies");
+ // @formatter:on
}
+ /**
+ * This constructs a new instance of our {@link MetricsService}.
+ *
+ * @param plugin
+ * Our {@link SlimefunPlugin} instance
+ */
public MetricsService(@Nonnull SlimefunPlugin plugin) {
this.plugin = plugin;
this.parentFolder = new File(plugin.getDataFolder(), "cache" + File.separatorChar + "modules");
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/PersistentDataService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/PersistentDataService.java
deleted file mode 100644
index b1792f546..000000000
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/PersistentDataService.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package io.github.thebusybiscuit.slimefun4.core.services;
-
-import java.util.Optional;
-
-import org.bukkit.NamespacedKey;
-import org.bukkit.persistence.PersistentDataContainer;
-import org.bukkit.persistence.PersistentDataHolder;
-import org.bukkit.persistence.PersistentDataType;
-
-import io.github.thebusybiscuit.cscorelib2.data.PersistentDataAPI;
-import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
-
-/**
- * This interface is used to defer calls to Persistent Data and make sure they are only called
- * if the {@link MinecraftVersion} supports it.
- *
- * @author TheBusyBiscuit
- *
- * @deprecated This is redundant, we can use {@link PersistentDataAPI} instead.
- *
- */
-@Deprecated
-interface PersistentDataService {
-
- default void setString(Object obj, NamespacedKey key, String value) {
- PersistentDataContainer container = ((PersistentDataHolder) obj).getPersistentDataContainer();
- container.set(key, PersistentDataType.STRING, value);
- }
-
- default Optional getString(Object obj, NamespacedKey key) {
- PersistentDataContainer container = ((PersistentDataHolder) obj).getPersistentDataContainer();
- return Optional.ofNullable(container.get(key, PersistentDataType.STRING));
- }
-
-}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/ContributionsConnector.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/ContributionsConnector.java
index f38e0c035..3d2368cea 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/ContributionsConnector.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/ContributionsConnector.java
@@ -16,11 +16,28 @@ import me.mrCookieSlime.Slimefun.api.Slimefun;
class ContributionsConnector extends GitHubConnector {
- // GitHub Bots that do not count as Contributors
- // (includes "invalid-email-address" because it is an invalid contributor)
- private static final List blacklist = Arrays.asList("invalid-email-address", "renovate-bot", "TheBusyBot", "ImgBotApp", "imgbot", "imgbot[bot]", "github-actions[bot]", "gitlocalize-app", "gitlocalize-app[bot]", "mt-gitlocalize");
+ /*
+ * @formatter:off
+ * GitHub Bots that do not count as Contributors
+ * (includes "invalid-email-address" because it is an invalid contributor)
+ */
+ private static final List blacklist = Arrays.asList(
+ "invalid-email-address",
+ "renovate-bot",
+ "TheBusyBot",
+ "ImgBotApp",
+ "imgbot",
+ "imgbot[bot]",
+ "github-actions[bot]",
+ "gitlocalize-app",
+ "gitlocalize-app[bot]",
+ "mt-gitlocalize"
+ );
- // Matches a GitHub name with a Minecraft name.
+ /*
+ * @formatter:on
+ * Matches a GitHub name with a Minecraft name.
+ */
private static final Map aliases = new HashMap<>();
// Should probably be switched to UUIDs at some point...
@@ -82,8 +99,16 @@ class ContributionsConnector extends GitHubConnector {
}
@Override
- public String getURLSuffix() {
- return "/contributors?per_page=100&page=" + page;
+ public String getEndpoint() {
+ return "/contributors";
+ }
+
+ @Override
+ public Map getParameters() {
+ Map parameters = new HashMap<>();
+ parameters.put("per_page", 100);
+ parameters.put("page", page);
+ return parameters;
}
private void computeContributors(@Nonnull JSONArray array) {
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubActivityConnector.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubActivityConnector.java
index e55fc722e..33b6d23e1 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubActivityConnector.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubActivityConnector.java
@@ -1,6 +1,8 @@
package io.github.thebusybiscuit.slimefun4.core.services.github;
import java.time.LocalDateTime;
+import java.util.HashMap;
+import java.util.Map;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -35,8 +37,13 @@ class GitHubActivityConnector extends GitHubConnector {
}
@Override
- public String getURLSuffix() {
+ public String getEndpoint() {
return "";
}
+ @Override
+ public Map getParameters() {
+ return new HashMap<>();
+ }
+
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubConnector.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubConnector.java
index 0f9e3e317..e06e00129 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubConnector.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubConnector.java
@@ -6,12 +6,13 @@ import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.net.URL;
import java.nio.charset.StandardCharsets;
+import java.util.Map;
import java.util.logging.Level;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import javax.annotation.ParametersAreNonnullByDefault;
import kong.unirest.HttpResponse;
import kong.unirest.JsonNode;
@@ -31,22 +32,49 @@ import me.mrCookieSlime.Slimefun.api.Slimefun;
abstract class GitHubConnector {
private static final String API_URL = "https://api.github.com/";
+ private static final String USER_AGENT = "Slimefun4 (https://github.com/Slimefun)";
- protected File file;
- protected String repository;
protected final GitHubService github;
+ private final String url;
+ private File file;
- @ParametersAreNonnullByDefault
- public GitHubConnector(GitHubService github, String repository) {
+ /**
+ * This creates a new {@link GitHubConnector} for the given repository.
+ *
+ * @param github
+ * Our instance of {@link GitHubService}
+ * @param repository
+ * The repository we want to connect to
+ */
+ GitHubConnector(@Nonnull GitHubService github, @Nonnull String repository) {
this.github = github;
- this.repository = repository;
+ this.url = API_URL + "repos/" + repository + getEndpoint();
}
+ /**
+ * This returns the name of our cache {@link File}.
+ *
+ * @return The cache {@link File} name
+ */
@Nonnull
public abstract String getFileName();
+ /**
+ * This is our {@link URL} endpoint.
+ * It is the suffix of the {@link URL} we want to connect to.
+ *
+ * @return Our endpoint
+ */
@Nonnull
- public abstract String getURLSuffix();
+ public abstract String getEndpoint();
+
+ /**
+ * This {@link Map} contains the query parameters for our {@link URL}.
+ *
+ * @return A {@link Map} with our query parameters
+ */
+ @Nonnull
+ public abstract Map getParameters();
/**
* This method is called when the connection finished successfully.
@@ -63,7 +91,12 @@ abstract class GitHubConnector {
// Don't do anything by default
}
- public void pullFile() {
+ /**
+ * This method will connect to GitHub and store the received data inside a local
+ * cache {@link File}.
+ * Make sure to call this method asynchronously!
+ */
+ void download() {
file = new File("plugins/Slimefun/cache/github/" + getFileName() + ".json");
if (github.isLoggingEnabled()) {
@@ -71,16 +104,19 @@ abstract class GitHubConnector {
}
try {
- HttpResponse resp = Unirest.get(API_URL + "repos/" + repository + getURLSuffix())
- .header("User-Agent", "Slimefun4 (https://github.com/Slimefun)")
+ // @formatter:off
+ HttpResponse response = Unirest.get(url)
+ .queryString(getParameters())
+ .header("User-Agent", USER_AGENT)
.asJson();
+ // @formatter:on
- if (resp.isSuccess()) {
- onSuccess(resp.getBody());
- writeCacheFile(resp.getBody());
+ if (response.isSuccess()) {
+ onSuccess(response.getBody());
+ writeCacheFile(response.getBody());
} else {
if (github.isLoggingEnabled()) {
- Slimefun.getLogger().log(Level.WARNING, "Failed to fetch {0}: {1} - {2}", new Object[] { repository + getURLSuffix(), resp.getStatus(), resp.getBody() });
+ Slimefun.getLogger().log(Level.WARNING, "Failed to fetch {0}: {1} - {2}", new Object[] { url, response.getStatus(), response.getBody() });
}
// It has the cached file, let's just read that then
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubIssuesConnector.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubIssuesConnector.java
index b22d9f491..38335e529 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubIssuesConnector.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubIssuesConnector.java
@@ -1,5 +1,7 @@
package io.github.thebusybiscuit.slimefun4.core.services.github;
+import java.util.HashMap;
+import java.util.Map;
import java.util.logging.Level;
import javax.annotation.Nonnull;
@@ -50,8 +52,15 @@ class GitHubIssuesConnector extends GitHubConnector {
}
@Override
- public String getURLSuffix() {
- return "/issues?per_page=100";
+ public String getEndpoint() {
+ return "/issues";
+ }
+
+ @Override
+ public Map getParameters() {
+ Map parameters = new HashMap<>();
+ parameters.put("per_page", 100);
+ return parameters;
}
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubService.java
index b7a2fc07d..f7d103f24 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubService.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubService.java
@@ -57,7 +57,8 @@ public class GitHubService {
}
public void start(@Nonnull SlimefunPlugin plugin) {
- plugin.getServer().getScheduler().runTaskTimerAsynchronously(plugin, new GitHubTask(this), 80L, 60 * 60 * 20L);
+ GitHubTask task = new GitHubTask(this);
+ plugin.getServer().getScheduler().runTaskTimerAsynchronously(plugin, task, 80L, 60 * 60 * 20L);
}
/**
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubTask.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubTask.java
index 932bf7060..151afa635 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubTask.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubTask.java
@@ -1,5 +1,6 @@
package io.github.thebusybiscuit.slimefun4.core.services.github;
+import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@@ -38,10 +39,14 @@ class GitHubTask implements Runnable {
@Override
public void run() {
- gitHubService.getConnectors().forEach(GitHubConnector::pullFile);
+ gitHubService.getConnectors().forEach(GitHubConnector::download);
grabTextures();
}
+ /**
+ * This method will pull the skin textures for every {@link Contributor} and store
+ * the {@link UUID} and received skin inside a local cache {@link File}.
+ */
private void grabTextures() {
// Store all queried usernames to prevent 429 responses for pinging the
// same URL twice in one run.
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/SlimefunLocalization.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/SlimefunLocalization.java
index dc1bea4b1..79523c45a 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/SlimefunLocalization.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/SlimefunLocalization.java
@@ -31,14 +31,14 @@ import me.mrCookieSlime.Slimefun.Lists.RecipeType;
* This is an abstract parent class of {@link LocalizationService}.
* There is not really much more I can say besides that...
*
- * @author TheBusyBiscui
+ * @author TheBusyBiscuit
*
* @see LocalizationService
*
*/
public abstract class SlimefunLocalization extends Localization implements Keyed {
- public SlimefunLocalization(@Nonnull SlimefunPlugin plugin) {
+ protected SlimefunLocalization(@Nonnull SlimefunPlugin plugin) {
super(plugin);
}
@@ -71,6 +71,15 @@ public abstract class SlimefunLocalization extends Localization implements Keyed
*/
public abstract Language getDefaultLanguage();
+ /**
+ * This returns whether a {@link Language} with the given id exists within
+ * the project resources.
+ *
+ * @param id
+ * The {@link Language} id
+ *
+ * @return Whether the project contains a {@link Language} with that id
+ */
protected abstract boolean hasLanguage(@Nonnull String id);
/**
@@ -82,10 +91,23 @@ public abstract class SlimefunLocalization extends Localization implements Keyed
@Nonnull
public abstract Collection getLanguages();
+ /**
+ * This method adds a new {@link Language} with the given id and texture.
+ *
+ * @param id
+ * The {@link Language} id
+ * @param texture
+ * The texture of how this {@link Language} should be displayed
+ */
protected abstract void addLanguage(@Nonnull String id, @Nonnull String texture);
+ /**
+ * This will load every {@link SupportedLanguage} into memory.
+ * To be precise: It performs {@link #addLanguage(String, String)} for every
+ * value of {@link SupportedLanguage}.
+ */
protected void loadEmbeddedLanguages() {
- for (SupportedLanguage lang : SupportedLanguage.valuesCache) {
+ for (SupportedLanguage lang : SupportedLanguage.values()) {
if (lang.isReadyForRelease() || SlimefunPlugin.getUpdater().getBranch() != SlimefunBranch.STABLE) {
addLanguage(lang.getLanguageId(), lang.getTexture());
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/SupportedLanguage.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/SupportedLanguage.java
index a6381a059..7e9dfd85d 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/SupportedLanguage.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/SupportedLanguage.java
@@ -58,8 +58,6 @@ enum SupportedLanguage {
MACEDONIAN("mk", false, "a0e0b0b5d87a855466980a101a757bcdb5f77d9f7287889f3efa998ee0472fc0"),
TAGALOG("tl", true, "9306c0c1ce6a9c61bb42a572c49e6d0ed20e0e6b3d122cc64c339cbf78e9e937");
- public static final SupportedLanguage[] valuesCache = values();
-
private final String id;
private final boolean releaseReady;
private final String textureHash;
@@ -71,11 +69,22 @@ enum SupportedLanguage {
this.textureHash = textureHash;
}
+ /**
+ * This returns the id of this {@link Language}.
+ *
+ * @return
+ */
@Nonnull
public String getLanguageId() {
return id;
}
+ /**
+ * This returns whether this {@link SupportedLanguage} is "release-ready".
+ * A release-ready {@link Language} will be available in RC builds of Slimefun.
+ *
+ * @return Whether this {@link Language} is "release-ready"
+ */
public boolean isReadyForRelease() {
return releaseReady;
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java
index dd5f95a95..c82fea35f 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Translators.java
@@ -120,6 +120,7 @@ public class Translators {
// Translators - Chinese (Taiwan)
addTranslator("BrineYT", "HeroBrineKing", SupportedLanguage.CHINESE_TAIWAN, true);
addTranslator("mio9", SupportedLanguage.CHINESE_TAIWAN, true);
+ addTranslator("ALiangLiang", SupportedLanguage.CHINESE_TAIWAN, true);
// Translators - Arabic
addTranslator("mohkamfer", "AgentBabbie", SupportedLanguage.ARABIC, false);
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/plugins/ThirdPartyPluginService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/plugins/ThirdPartyPluginService.java
index 4bf85071f..1b4e5e1a4 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/plugins/ThirdPartyPluginService.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/plugins/ThirdPartyPluginService.java
@@ -101,9 +101,6 @@ public class ThirdPartyPluginService {
// mcMMO Integration
if (isPluginInstalled("mcMMO")) {
try {
- // This makes sure that the FakeEvent interface is present.
- // Class.forName("com.gmail.nossr50.events.fake.FakeEvent");
-
new McMMOIntegration(plugin);
isMcMMOInstalled = true;
} catch (Exception | LinkageError x) {
@@ -170,7 +167,7 @@ public class ThirdPartyPluginService {
* @return Whether this is a fake event
*/
public boolean isEventFaked(@Nonnull Event event) {
- // TODO: Change this to FakeEvent once the new mcMMO build was released
+ // This can be changed to "FakeEvent" in a later version
return isMcMMOInstalled && event instanceof FakeBlockBreakEvent;
}
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 68c8b2d88..a4224da9e 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java
@@ -408,7 +408,7 @@ public final class SlimefunItems {
public static final SlimefunItemStack PLASTIC_SHEET = new SlimefunItemStack("PLASTIC_SHEET", Material.PAPER, "&fPlastic Sheet");
public static final SlimefunItemStack MAGNET = new SlimefunItemStack("MAGNET", HeadTexture.MAGNET, "&cMagnet");
- public static final SlimefunItemStack NECROTIC_SKULL = new SlimefunItemStack("NECROTIC_SKULL", Material.WITHER_SKELETON_SKULL, "&cNecrotic Skull");
+ public static final SlimefunItemStack NECROTIC_SKULL = new SlimefunItemStack("NECROTIC_SKULL", HeadTexture.NECROTIC_SKULL, "&cNecrotic Skull");
public static final SlimefunItemStack ESSENCE_OF_AFTERLIFE = new SlimefunItemStack("ESSENCE_OF_AFTERLIFE", Material.GUNPOWDER, "&4Essence of Afterlife");
public static final SlimefunItemStack STRANGE_NETHER_GOO = new SlimefunItemStack("STRANGE_NETHER_GOO", Material.PURPLE_DYE, "&5Strange Nether Goo", "", "&fA strange bio matter that", "&fcan be acquired from", "&fbartering with Piglins");
public static final SlimefunItemStack ELECTRO_MAGNET = new SlimefunItemStack("ELECTRO_MAGNET", HeadTexture.MAGNET, "&cElectromagnet");
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java
index 23bfb15fb..71820abf7 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java
@@ -176,11 +176,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
instance = this;
if (minecraftVersion == MinecraftVersion.UNIT_TEST) {
- local = new LocalizationService(this, "", null);
- gpsNetwork = new GPSNetwork();
- networkManager = new NetworkManager(200);
- command.register();
- registry.load(config);
+ onUnitTestStart();
} else if (getServer().getPluginManager().isPluginEnabled("CS-CoreLib")) {
getLogger().log(Level.INFO, "CS-CoreLib was detected!");
long timestamp = System.nanoTime();
@@ -223,7 +219,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
networkSize = 1;
}
- networkManager = new NetworkManager(networkSize);
+ networkManager = new NetworkManager(networkSize, config.getBoolean("networks.enable-visualizer"));
// Setting up bStats
new Thread(metricsService::start, "Slimefun Metrics").start();
@@ -307,6 +303,14 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
}
}
+ private void onUnitTestStart() {
+ local = new LocalizationService(this, "", null);
+ gpsNetwork = new GPSNetwork();
+ networkManager = new NetworkManager(200, true);
+ command.register();
+ registry.load(config);
+ }
+
@Nonnull
private String getStartupTime(long timestamp) {
long ms = (System.nanoTime() - timestamp) / 1000000;
@@ -489,6 +493,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
new AncientAltarListener(this, (AncientAltar) SlimefunItems.ANCIENT_ALTAR.getItem(), (AncientPedestal) SlimefunItems.ANCIENT_PEDESTAL.getItem());
grapplingHookListener.register(this, (GrapplingHook) SlimefunItems.GRAPPLING_HOOK.getItem());
bowListener.register(this);
+ backpackListener.register(this);
// Toggleable Listeners for performance reasons
if (config.getBoolean("items.talismans")) {
@@ -499,10 +504,6 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
new SoulboundListener(this);
}
- if (config.getBoolean("items.backpacks")) {
- backpackListener.register(this);
- }
-
// Handle Slimefun Guide being given on Join
new SlimefunGuideListener(this, config.getBoolean("guide.receive-on-first-join"));
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/BookSlimefunGuide.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/BookSlimefunGuide.java
index 59b081e82..26f894046 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/BookSlimefunGuide.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/BookSlimefunGuide.java
@@ -215,7 +215,11 @@ public class BookSlimefunGuide implements SlimefunGuideImplementation {
ChatComponent component = new ChatComponent(ChatUtils.crop(ChatColor.RED, item.getItemName()) + "\n");
component.setHoverEvent(new HoverEvent(ChatColor.RESET + item.getItemName(), ChatColor.DARK_RED.toString() + ChatColor.BOLD + SlimefunPlugin.getLocalization().getMessage(p, "guide.locked"), "", ChatColor.GREEN + "> Click to unlock", "", ChatColor.GRAY + "Cost: " + ChatColor.AQUA.toString() + research.getCost() + " Level(s)"));
- component.setClickEvent(new ClickEvent(key, player -> research(player, profile, item, research, category, page)));
+ component.setClickEvent(new ClickEvent(key, player ->
+ SlimefunPlugin.runSync(() ->
+ research.unlockFromGuide(this, player, profile, item, category, page)
+ )
+ ));
items.add(component);
} else {
@@ -234,22 +238,6 @@ public class BookSlimefunGuide implements SlimefunGuideImplementation {
}
}
- private void research(Player p, PlayerProfile profile, SlimefunItem item, Research research, Category category, int page) {
- SlimefunPlugin.runSync(() -> {
- if (!SlimefunPlugin.getRegistry().getCurrentlyResearchingPlayers().contains(p.getUniqueId())) {
- if (research.canUnlock(p)) {
- if (profile.hasUnlocked(research)) {
- openCategory(profile, category, page);
- } else {
- unlockItem(p, item, pl -> openCategory(profile, category, page));
- }
- } else {
- SlimefunPlugin.getLocalization().sendMessage(p, "messages.not-enough-xp", true);
- }
- }
- });
- }
-
@Override
public void openSearch(PlayerProfile profile, String input, boolean addToHistory) {
// We need to write a book implementation for this at some point
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/ChestSlimefunGuide.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/ChestSlimefunGuide.java
index cbab11d87..e140f2b7c 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/ChestSlimefunGuide.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/ChestSlimefunGuide.java
@@ -9,6 +9,7 @@ import java.util.Optional;
import java.util.logging.Level;
import javax.annotation.Nonnull;
+import javax.annotation.ParametersAreNonnullByDefault;
import org.bukkit.ChatColor;
import org.bukkit.Material;
@@ -64,14 +65,14 @@ import me.mrCookieSlime.Slimefun.api.Slimefun;
public class ChestSlimefunGuide implements SlimefunGuideImplementation {
private static final int CATEGORY_SIZE = 36;
+ private static final Sound sound = Sound.ITEM_BOOK_PAGE_TURN;
- private final ItemStack item;
private final int[] recipeSlots = { 3, 4, 5, 12, 13, 14, 21, 22, 23 };
- private final Sound sound = Sound.ITEM_BOOK_PAGE_TURN;
+ private final ItemStack item;
private final boolean showVanillaRecipes;
- public ChestSlimefunGuide(boolean vanillaRecipes) {
- showVanillaRecipes = vanillaRecipes;
+ public ChestSlimefunGuide(boolean showVanillaRecipes) {
+ this.showVanillaRecipes = showVanillaRecipes;
item = new SlimefunGuideItem(this, "&aSlimefun Guide &7(Chest GUI)");
}
@@ -125,7 +126,6 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
}
ChestMenu menu = create(p);
-
List categories = getVisibleCategories(p, profile);
int index = 9;
@@ -271,23 +271,12 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
if (isSurvivalMode() && !Slimefun.hasPermission(p, sfitem, false)) {
List message = SlimefunPlugin.getPermissionsService().getLore(sfitem);
- menu.addItem(index, new CustomItem(Material.BARRIER, sfitem.getItemName(), message.toArray(new String[0])));
+ menu.addItem(index, new CustomItem(ChestMenuUtils.getNoPermissionItem(), sfitem.getItemName(), message.toArray(new String[0])));
menu.addMenuClickHandler(index, ChestMenuUtils.getEmptyClickHandler());
} else if (isSurvivalMode() && research != null && !profile.hasUnlocked(research)) {
- menu.addItem(index, new CustomItem(Material.BARRIER, ChatColor.WHITE + ItemUtils.getItemName(sfitem.getItem()), "&4&l" + SlimefunPlugin.getLocalization().getMessage(p, "guide.locked"), "", "&a> Click to unlock", "", "&7Cost: &b" + research.getCost() + " Level(s)"));
+ menu.addItem(index, new CustomItem(ChestMenuUtils.getNotResearchedItem(), ChatColor.WHITE + ItemUtils.getItemName(sfitem.getItem()), "&4&l" + SlimefunPlugin.getLocalization().getMessage(p, "guide.locked"), "", "&a> Click to unlock", "", "&7Cost: &b" + research.getCost() + " Level(s)"));
menu.addMenuClickHandler(index, (pl, slot, item, action) -> {
- if (!SlimefunPlugin.getRegistry().getCurrentlyResearchingPlayers().contains(pl.getUniqueId())) {
- if (research.canUnlock(pl)) {
- if (profile.hasUnlocked(research)) {
- openCategory(profile, category, page);
- } else {
- unlockItem(pl, sfitem, player -> openCategory(profile, category, page));
- }
- } else {
- SlimefunPlugin.getLocalization().sendMessage(pl, "messages.not-enough-xp", true);
- }
- }
-
+ research.unlockFromGuide(this, p, profile, sfitem, category, page);
return false;
});
} else {
@@ -334,26 +323,14 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
int index = 9;
// Find items and add them
for (SlimefunItem slimefunItem : SlimefunPlugin.getRegistry().getEnabledSlimefunItems()) {
- String itemName = ChatColor.stripColor(slimefunItem.getItemName()).toLowerCase(Locale.ROOT);
-
if (index == 44) {
break;
}
- if (!itemName.isEmpty() && (itemName.equals(searchTerm) || itemName.contains(searchTerm))) {
+ if (isSearchFilterApplicable(slimefunItem, searchTerm)) {
ItemStack itemstack = new CustomItem(slimefunItem.getItem(), meta -> {
- List lore = null;
Category category = slimefunItem.getCategory();
-
- if (category != null) {
- ItemStack categoryItem = category.getItem(p);
-
- if (categoryItem != null && categoryItem.hasItemMeta() && categoryItem.getItemMeta().hasDisplayName()) {
- lore = Arrays.asList("", ChatColor.DARK_GRAY + "\u21E8 " + ChatColor.WHITE + categoryItem.getItemMeta().getDisplayName());
- }
- }
-
- meta.setLore(lore);
+ meta.setLore(Arrays.asList("", ChatColor.DARK_GRAY + "\u21E8 " + ChatColor.WHITE + category.getDisplayName(p)));
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_POTION_EFFECTS);
});
@@ -379,6 +356,12 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
menu.open(p);
}
+ @ParametersAreNonnullByDefault
+ private boolean isSearchFilterApplicable(SlimefunItem slimefunItem, String searchTerm) {
+ String itemName = ChatColor.stripColor(slimefunItem.getItemName()).toLowerCase(Locale.ROOT);
+ return !itemName.isEmpty() && (itemName.equals(searchTerm) || itemName.contains(searchTerm));
+ }
+
@Override
public void displayItem(PlayerProfile profile, ItemStack item, int index, boolean addToHistory) {
Player p = profile.getPlayer();
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/RadioactiveItem.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/RadioactiveItem.java
index a17c61a3d..c445c93aa 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/RadioactiveItem.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/RadioactiveItem.java
@@ -31,6 +31,9 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
*/
public class RadioactiveItem extends SlimefunItem implements Radioactive, NotPlaceable {
+ /**
+ * This is the level of {@link Radioactivity} for this {@link SlimefunItem}
+ */
private final Radioactivity radioactivity;
/**
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/AndroidType.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/AndroidType.java
index 61e7a2eaa..732c998a3 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/AndroidType.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/AndroidType.java
@@ -1,5 +1,7 @@
package io.github.thebusybiscuit.slimefun4.implementation.items.androids;
+import javax.annotation.Nonnull;
+
/**
* This enum holds all the different types a {@link ProgrammableAndroid} can represent.
*
@@ -55,7 +57,7 @@ public enum AndroidType {
*/
NON_FIGHTER;
- boolean isType(AndroidType type) {
+ boolean isType(@Nonnull AndroidType type) {
return type == NONE || type == this || (type == NON_FIGHTER && this != FIGHTER);
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FisherAndroid.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FisherAndroid.java
index de83525a7..9dd3373d7 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FisherAndroid.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FisherAndroid.java
@@ -57,7 +57,7 @@ public class FisherAndroid extends ProgrammableAndroid {
if (ThreadLocalRandom.current().nextInt(100) < 10 * getTier()) {
ItemStack drop = fishingLoot.getRandom();
- menu.pushItem(drop, getOutputSlots());
+ menu.pushItem(drop.clone(), getOutputSlots());
}
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/Instruction.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/Instruction.java
index 4a2083b05..6c707c979 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/Instruction.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/Instruction.java
@@ -8,6 +8,7 @@ import java.util.Map;
import java.util.function.Predicate;
import org.apache.commons.lang.Validate;
+import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Ageable;
@@ -20,126 +21,223 @@ import io.github.thebusybiscuit.slimefun4.utils.HeadTexture;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
-enum Instruction {
+/**
+ * This enum holds every {@link Instruction} for the {@link ProgrammableAndroid}
+ * added by Slimefun itself.
+ *
+ * @author TheBusyBiscuit
+ *
+ */
+public enum Instruction {
- // Start and End Parts
+ /**
+ * This {@link Instruction} is the starting point of a {@link Script}.
+ */
START(AndroidType.NONE, HeadTexture.SCRIPT_START),
+
+ /**
+ * This {@link Instruction} is the end token of a {@link Script}.
+ * Once this {@link Instruction} is reached, the {@link Script} will start again.
+ */
REPEAT(AndroidType.NONE, HeadTexture.SCRIPT_REPEAT),
+
+ /**
+ * This {@link Instruction} will make the {@link ProgrammableAndroid} wait
+ * for one Slimefun tick.
+ */
WAIT(AndroidType.NONE, HeadTexture.SCRIPT_WAIT),
- // Movement
+ /**
+ * This will make the {@link ProgrammableAndroid} go forward.
+ */
GO_FORWARD(AndroidType.NON_FIGHTER, HeadTexture.SCRIPT_FORWARD, (android, b, inv, face) -> {
Block target = b.getRelative(face);
android.move(b, face, target);
}),
+ /**
+ * This will make the {@link ProgrammableAndroid} go up.
+ */
GO_UP(AndroidType.NON_FIGHTER, HeadTexture.SCRIPT_UP, (android, b, inv, face) -> {
Block target = b.getRelative(BlockFace.UP);
android.move(b, face, target);
}),
+ /**
+ * This will make the {@link ProgrammableAndroid} go down.
+ */
GO_DOWN(AndroidType.NON_FIGHTER, HeadTexture.SCRIPT_DOWN, (android, b, inv, face) -> {
Block target = b.getRelative(BlockFace.DOWN);
android.move(b, face, target);
}),
- // Directions
+ /**
+ * This will make the {@link ProgrammableAndroid} rotate to the left side.
+ */
TURN_LEFT(AndroidType.NONE, HeadTexture.SCRIPT_LEFT, (android, b, inv, face) -> {
int mod = -1;
android.rotate(b, face, mod);
}),
+ /**
+ * This will make the {@link ProgrammableAndroid} rotate to the right side.
+ */
TURN_RIGHT(AndroidType.NONE, HeadTexture.SCRIPT_RIGHT, (android, b, inv, face) -> {
int mod = 1;
android.rotate(b, face, mod);
}),
- // Action - Pickaxe
+ /**
+ * This will make a {@link MinerAndroid} dig the {@link Block} above.
+ */
DIG_UP(AndroidType.MINER, HeadTexture.SCRIPT_DIG_UP, (android, b, inv, face) -> {
Block target = b.getRelative(BlockFace.UP);
android.dig(b, inv, target);
}),
+ /**
+ * This will make a {@link MinerAndroid} dig the {@link Block} ahead.
+ */
DIG_FORWARD(AndroidType.MINER, HeadTexture.SCRIPT_DIG_FORWARD, (android, b, inv, face) -> {
Block target = b.getRelative(face);
android.dig(b, inv, target);
}),
+ /**
+ * This will make a {@link MinerAndroid} dig the {@link Block} below.
+ */
DIG_DOWN(AndroidType.MINER, HeadTexture.SCRIPT_DIG_DOWN, (android, b, inv, face) -> {
Block target = b.getRelative(BlockFace.DOWN);
android.dig(b, inv, target);
}),
+ /**
+ * This will make a {@link MinerAndroid} dig the {@link Block} above
+ * and then move itself to that new {@link Location}.
+ */
MOVE_AND_DIG_UP(AndroidType.MINER, HeadTexture.SCRIPT_DIG_UP, (android, b, inv, face) -> {
Block target = b.getRelative(BlockFace.UP);
android.moveAndDig(b, inv, face, target);
}),
+ /**
+ * This will make a {@link MinerAndroid} dig the {@link Block} ahead
+ * and then move itself to that new {@link Location}.
+ */
MOVE_AND_DIG_FORWARD(AndroidType.MINER, HeadTexture.SCRIPT_DIG_FORWARD, (android, b, inv, face) -> {
Block target = b.getRelative(face);
android.moveAndDig(b, inv, face, target);
}),
+ /**
+ * This will make a {@link MinerAndroid} dig the {@link Block} below
+ * and then move itself to that new {@link Location}.
+ */
MOVE_AND_DIG_DOWN(AndroidType.MINER, HeadTexture.SCRIPT_DIG_DOWN, (android, b, inv, face) -> {
Block target = b.getRelative(BlockFace.DOWN);
android.moveAndDig(b, inv, face, target);
}),
- // Action - Sword
+ /**
+ * This will make a {@link ButcherAndroid} attack any {@link LivingEntity}
+ * ahead of them.
+ */
ATTACK_MOBS_ANIMALS(AndroidType.FIGHTER, HeadTexture.SCRIPT_ATTACK, (android, b, inv, face) -> {
Predicate predicate = e -> true;
android.attack(b, face, predicate);
}),
+ /**
+ * This will make a {@link ButcherAndroid} attack any {@link Monster}
+ * ahead of them.
+ */
ATTACK_MOBS(AndroidType.FIGHTER, HeadTexture.SCRIPT_ATTACK, (android, b, inv, face) -> {
Predicate predicate = e -> e instanceof Monster;
android.attack(b, face, predicate);
}),
+ /**
+ * This will make a {@link ButcherAndroid} attack any {@link Animals Animal}
+ * ahead of them.
+ */
ATTACK_ANIMALS(AndroidType.FIGHTER, HeadTexture.SCRIPT_ATTACK, (android, b, inv, face) -> {
Predicate predicate = e -> e instanceof Animals;
android.attack(b, face, predicate);
}),
+ /**
+ * This will make a {@link ButcherAndroid} attack any adult
+ * {@link Animals Animal} ahead of them.
+ */
ATTACK_ANIMALS_ADULT(AndroidType.FIGHTER, HeadTexture.SCRIPT_ATTACK, (android, b, inv, face) -> {
- Predicate predicate = e -> e instanceof Animals && e instanceof Ageable && ((Ageable) e).isAdult();
+ Predicate predicate = e -> e instanceof Animals && ((Ageable) e).isAdult();
android.attack(b, face, predicate);
}),
- // Action - Axe
+ /**
+ * This will make a {@link WoodcutterAndroid} chop down the tree in front of them.
+ */
CHOP_TREE(AndroidType.WOODCUTTER, HeadTexture.SCRIPT_CHOP_TREE),
- // Action - Fishing Rod
+ /**
+ * This {@link Instruction} makes a {@link FisherAndroid} try to catch fish from
+ * the water below.
+ */
CATCH_FISH(AndroidType.FISHERMAN, HeadTexture.SCRIPT_FISH, (android, b, inv, face) -> android.fish(b, inv)),
- // Action - Hoe
+ /**
+ * This {@link Instruction} will make a {@link FarmerAndroid} try to harvest
+ * the {@link Block} in front of them.
+ */
FARM_FORWARD(AndroidType.FARMER, HeadTexture.SCRIPT_FARM_FORWARD, (android, b, inv, face) -> {
Block target = b.getRelative(face);
android.farm(inv, target);
}),
+ /**
+ * This {@link Instruction} will make a {@link FarmerAndroid} try to harvest
+ * the {@link Block} below.
+ */
FARM_DOWN(AndroidType.FARMER, HeadTexture.SCRIPT_FARM_DOWN, (android, b, inv, face) -> {
Block target = b.getRelative(BlockFace.DOWN);
android.farm(inv, target);
}),
- // Action - ExoticGarden
+ /**
+ * This {@link Instruction} will make a {@link FarmerAndroid} try to harvest
+ * the {@link Block} in front of them.
+ *
+ * This includes plants from ExoticGarden.
+ */
FARM_EXOTIC_FORWARD(AndroidType.ADVANCED_FARMER, HeadTexture.SCRIPT_FARM_FORWARD, (android, b, inv, face) -> {
Block target = b.getRelative(face);
android.exoticFarm(inv, target);
}),
+ /**
+ * This {@link Instruction} will make a {@link FarmerAndroid} try to harvest
+ * the {@link Block} below.
+ *
+ * This includes plants from ExoticGarden.
+ */
FARM_EXOTIC_DOWN(AndroidType.ADVANCED_FARMER, HeadTexture.SCRIPT_FARM_DOWN, (android, b, inv, face) -> {
Block target = b.getRelative(BlockFace.DOWN);
android.exoticFarm(inv, target);
}),
- // Action - Interface
+ /**
+ * This {@link Instruction} will force the {@link ProgrammableAndroid} to push their
+ * items into an {@link AndroidInterface} ahead of them.
+ */
INTERFACE_ITEMS(AndroidType.NONE, HeadTexture.SCRIPT_PUSH_ITEMS, (android, b, inv, face) -> {
Block target = b.getRelative(face);
android.depositItems(inv, target);
}),
+ /**
+ * This {@link Instruction} will force the {@link ProgrammableAndroid} to pull
+ * fuel from an {@link AndroidInterface} ahead of them.
+ */
INTERFACE_FUEL(AndroidType.NONE, HeadTexture.SCRIPT_PULL_FUEL, (android, b, inv, face) -> {
Block target = b.getRelative(face);
android.refuel(inv, target);
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 b57b449e4..428e6e732 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
@@ -58,6 +58,7 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.InventoryBlock;
import me.mrCookieSlime.Slimefun.Objects.handlers.BlockTicker;
import me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
+import me.mrCookieSlime.Slimefun.api.Slimefun;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
@@ -69,6 +70,7 @@ public class ProgrammableAndroid extends SlimefunItem implements InventoryBlock,
private static final int[] BORDER = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 18, 24, 25, 26, 27, 33, 35, 36, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53 };
private static final int[] OUTPUT_BORDER = { 10, 11, 12, 13, 14, 19, 23, 28, 32, 37, 38, 39, 40, 41 };
private static final String DEFAULT_SCRIPT = "START-TURN_LEFT-REPEAT";
+ private static final int MAX_SCRIPT_LENGTH = 54;
protected final List fuelTypes = new ArrayList<>();
protected final String texture;
@@ -407,19 +409,23 @@ public class ProgrammableAndroid extends SlimefunItem implements InventoryBlock,
} else {
Script script = scripts.get(target);
menu.addItem(index, script.getAsItemStack(this, p), (player, slot, stack, action) -> {
- if (action.isShiftClicked()) {
- if (script.isAuthor(player)) {
- SlimefunPlugin.getLocalization().sendMessage(player, "android.scripts.rating.own", true);
- } else if (script.canRate(player)) {
- script.rate(player, !action.isRightClicked());
- openScriptDownloader(player, b, page);
- } else {
- SlimefunPlugin.getLocalization().sendMessage(player, "android.scripts.rating.already", true);
+ try {
+ if (action.isShiftClicked()) {
+ if (script.isAuthor(player)) {
+ SlimefunPlugin.getLocalization().sendMessage(player, "android.scripts.rating.own", true);
+ } else if (script.canRate(player)) {
+ script.rate(player, !action.isRightClicked());
+ openScriptDownloader(player, b, page);
+ } else {
+ SlimefunPlugin.getLocalization().sendMessage(player, "android.scripts.rating.already", true);
+ }
+ } else if (!action.isRightClicked()) {
+ script.download();
+ setScript(b.getLocation(), script.getSourceCode());
+ openScriptEditor(player, b);
}
- } else if (!action.isRightClicked()) {
- script.download();
- setScript(b.getLocation(), script.getSourceCode());
- openScriptEditor(player, b);
+ } catch (Exception x) {
+ Slimefun.getLogger().log(Level.SEVERE, "An Exception was thrown when a User tried to download a Script!", x);
}
return false;
@@ -534,12 +540,19 @@ public class ProgrammableAndroid extends SlimefunItem implements InventoryBlock,
}
@Nonnull
- protected String getScript(@Nonnull Location l) {
+ public String getScript(@Nonnull Location l) {
+ Validate.notNull(l, "Location for android not specified");
String script = BlockStorage.getLocationInfo(l, "script");
return script != null ? script : DEFAULT_SCRIPT;
}
- protected void setScript(@Nonnull Location l, @Nonnull String script) {
+ public void setScript(@Nonnull Location l, @Nonnull String script) {
+ Validate.notNull(l, "Location for android not specified");
+ Validate.notNull(script, "No script given");
+ Validate.isTrue(script.startsWith(Instruction.START.name() + '-'), "A script must begin with a 'START' token.");
+ Validate.isTrue(script.endsWith('-' + Instruction.REPEAT.name()), "A script must end with a 'REPEAT' token.");
+ Validate.isTrue(PatternUtils.DASH.split(script).length <= MAX_SCRIPT_LENGTH, "Scripts may not have more than " + MAX_SCRIPT_LENGTH + " segments");
+
BlockStorage.addBlockInfo(l, "script", script);
}
@@ -794,12 +807,8 @@ public class ProgrammableAndroid extends SlimefunItem implements InventoryBlock,
}
private void constructMenu(@Nonnull BlockMenuPreset preset) {
- for (int i : BORDER) {
- preset.addItem(i, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler());
- }
- for (int i : OUTPUT_BORDER) {
- preset.addItem(i, ChestMenuUtils.getOutputSlotTexture(), ChestMenuUtils.getEmptyClickHandler());
- }
+ preset.drawBackground(BORDER);
+ preset.drawBackground(ChestMenuUtils.getOutputSlotTexture(), OUTPUT_BORDER);
for (int i : getOutputSlots()) {
preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() {
@@ -828,7 +837,7 @@ public class ProgrammableAndroid extends SlimefunItem implements InventoryBlock,
}
protected void move(Block b, BlockFace face, Block block) {
- if (block.getY() > 0 && block.getY() < block.getWorld().getMaxHeight() && (block.getType() == Material.AIR || block.getType() == Material.CAVE_AIR)) {
+ if (block.getY() > 0 && block.getY() < block.getWorld().getMaxHeight() && block.isEmpty()) {
BlockData blockData = Material.PLAYER_HEAD.createBlockData(data -> {
if (data instanceof Rotatable) {
Rotatable rotatable = ((Rotatable) data);
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/Script.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/Script.java
index 5d97975f7..7ee370638 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/Script.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/Script.java
@@ -130,18 +130,19 @@ public final class Script {
@Nonnull
ItemStack getAsItemStack(@Nonnull ProgrammableAndroid android, @Nonnull Player p) {
List lore = new LinkedList<>();
- lore.add("&7by &r" + getAuthor());
+ lore.add("&7by &f" + getAuthor());
lore.add("");
- lore.add("&7Downloads: &r" + getDownloads());
+ lore.add("&7Downloads: &f" + getDownloads());
lore.add("&7Rating: " + getScriptRatingPercentage());
lore.add("&a" + getUpvotes() + " \u263A &7| &4\u2639 " + getDownvotes());
lore.add("");
- lore.add("&eLeft Click &rto download this Script");
+ lore.add("&eLeft Click &fto download this Script");
lore.add("&4(This will override your current Script)");
if (canRate(p)) {
- lore.add("&eShift + Left Click &rto leave a positive Rating");
- lore.add("&eShift + Right Click &rto leave a negative Rating");
+ lore.add("");
+ lore.add("&eShift + Left Click &fto leave a positive Rating");
+ lore.add("&eShift + Right Click &fto leave a negative Rating");
}
return new CustomItem(android.getItem(), "&b" + getName(), lore.toArray(new String[0]));
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 e1d43bfc0..723ad0df3 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
@@ -11,7 +11,7 @@ import io.github.thebusybiscuit.slimefun4.core.handlers.BlockPlaceHandler;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
-import io.github.thebusybiscuit.slimefun4.utils.ColoredMaterials;
+import io.github.thebusybiscuit.slimefun4.utils.ColoredMaterial;
import io.github.thebusybiscuit.slimefun4.utils.HeadTexture;
import io.github.thebusybiscuit.slimefun4.utils.NumberUtils;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
@@ -100,7 +100,7 @@ abstract class AbstractCargoNode extends SlimefunItem {
menu.replaceExistingItem(slotCurrent, new CustomItem(HeadTexture.CHEST_TERMINAL.getAsItemStack(), "&bChannel ID: &3" + (channel + 1)));
menu.addMenuClickHandler(slotCurrent, ChestMenuUtils.getEmptyClickHandler());
} else {
- menu.replaceExistingItem(slotCurrent, new CustomItem(ColoredMaterials.WOOL.get(channel), "&bChannel ID: &3" + (channel + 1)));
+ menu.replaceExistingItem(slotCurrent, new CustomItem(ColoredMaterial.WOOL.get(channel), "&bChannel ID: &3" + (channel + 1)));
menu.addMenuClickHandler(slotCurrent, ChestMenuUtils.getEmptyClickHandler());
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/cargo/ReactorAccessPort.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/cargo/ReactorAccessPort.java
index 58a380771..05791763c 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/cargo/ReactorAccessPort.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/cargo/ReactorAccessPort.java
@@ -1,5 +1,7 @@
package io.github.thebusybiscuit.slimefun4.implementation.items.cargo;
+import javax.annotation.Nonnull;
+
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
@@ -107,22 +109,12 @@ public class ReactorAccessPort extends SlimefunItem {
});
}
- private void constructMenu(BlockMenuPreset preset) {
- for (int i : background) {
- preset.addItem(i, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler());
- }
+ private void constructMenu(@Nonnull BlockMenuPreset preset) {
+ preset.drawBackground(ChestMenuUtils.getBackground(), background);
- for (int i : fuelBorder) {
- preset.addItem(i, new CustomItem(new ItemStack(Material.LIME_STAINED_GLASS_PANE), " "), ChestMenuUtils.getEmptyClickHandler());
- }
-
- for (int i : inputBorder) {
- preset.addItem(i, new CustomItem(new ItemStack(Material.CYAN_STAINED_GLASS_PANE), " "), ChestMenuUtils.getEmptyClickHandler());
- }
-
- for (int i : outputBorder) {
- preset.addItem(i, new CustomItem(new ItemStack(Material.GREEN_STAINED_GLASS_PANE), " "), ChestMenuUtils.getEmptyClickHandler());
- }
+ preset.drawBackground(new CustomItem(Material.LIME_STAINED_GLASS_PANE, " "), fuelBorder);
+ preset.drawBackground(new CustomItem(Material.CYAN_STAINED_GLASS_PANE, " "), inputBorder);
+ preset.drawBackground(new CustomItem(Material.GREEN_STAINED_GLASS_PANE, " "), outputBorder);
preset.addItem(1, new CustomItem(SlimefunItems.URANIUM, "&7Fuel Slot", "", "&rThis Slot accepts radioactive Fuel such as:", "&2Uranium &ror &aNeptunium"), ChestMenuUtils.getEmptyClickHandler());
preset.addItem(22, new CustomItem(SlimefunItems.PLUTONIUM, "&7Byproduct Slot", "", "&rThis Slot contains the Reactor's Byproduct", "&rsuch as &aNeptunium &ror &7Plutonium"), ChestMenuUtils.getEmptyClickHandler());
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/BioGenerator.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/BioGenerator.java
index e1c624ede..ef165e5ba 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/BioGenerator.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/BioGenerator.java
@@ -13,7 +13,7 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AGenerator;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
-public abstract class BioGenerator extends AGenerator {
+public class BioGenerator extends AGenerator {
public BioGenerator(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/CoalGenerator.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/CoalGenerator.java
index 886164817..a375dc2b0 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/CoalGenerator.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/CoalGenerator.java
@@ -12,7 +12,7 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import javax.annotation.Nonnull;
-public abstract class CoalGenerator extends AGenerator {
+public class CoalGenerator extends AGenerator {
public CoalGenerator(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/CombustionGenerator.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/CombustionGenerator.java
index 2c7680b23..2f014413d 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/CombustionGenerator.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/CombustionGenerator.java
@@ -10,7 +10,7 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AGenerator;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
-public abstract class CombustionGenerator extends AGenerator {
+public class CombustionGenerator extends AGenerator {
public CombustionGenerator(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/LavaGenerator.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/LavaGenerator.java
index 096e92c91..eee08c34a 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/LavaGenerator.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/LavaGenerator.java
@@ -9,7 +9,7 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AGenerator;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
-public abstract class LavaGenerator extends AGenerator {
+public class LavaGenerator extends AGenerator {
public LavaGenerator(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/MagnesiumGenerator.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/MagnesiumGenerator.java
index ad4974988..e298926b0 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/MagnesiumGenerator.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/MagnesiumGenerator.java
@@ -10,7 +10,7 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AGenerator;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
-public abstract class MagnesiumGenerator extends AGenerator {
+public class MagnesiumGenerator extends AGenerator {
public MagnesiumGenerator(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AbstractEntityAssembler.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AbstractEntityAssembler.java
index ccd858373..e8d5b962f 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AbstractEntityAssembler.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AbstractEntityAssembler.java
@@ -66,17 +66,9 @@ public abstract class AbstractEntityAssembler extends SimpleSl
@Override
public void init() {
- for (int i : border) {
- addItem(i, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler());
- }
-
- for (int i : headBorder) {
- addItem(i, new CustomItem(getHeadBorder(), " "), ChestMenuUtils.getEmptyClickHandler());
- }
-
- for (int i : bodyBorder) {
- addItem(i, new CustomItem(getBodyBorder(), " "), ChestMenuUtils.getEmptyClickHandler());
- }
+ drawBackground(border);
+ drawBackground(new CustomItem(getHeadBorder(), " "), headBorder);
+ drawBackground(new CustomItem(getBodyBorder(), " "), bodyBorder);
constructMenu(this);
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoAnvil.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoAnvil.java
index 408e07519..5d25871e7 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoAnvil.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoAnvil.java
@@ -21,7 +21,7 @@ import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
* @author TheBusyBiscuit
*
*/
-public abstract class AutoAnvil extends AContainer {
+public class AutoAnvil extends AContainer {
private final int repairFactor;
@@ -36,11 +36,6 @@ public abstract class AutoAnvil extends AContainer {
return new ItemStack(Material.IRON_PICKAXE);
}
- @Override
- public int getSpeed() {
- return 1;
- }
-
@Override
public String getMachineIdentifier() {
return "AUTO_ANVIL";
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoBrewer.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoBrewer.java
index 78ef2961a..627fe50a9 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoBrewer.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoBrewer.java
@@ -3,6 +3,8 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machine
import java.util.EnumMap;
import java.util.Map;
+import javax.annotation.Nonnull;
+
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta;
@@ -24,7 +26,7 @@ import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
* @author Linox
*
*/
-public abstract class AutoBrewer extends AContainer {
+public class AutoBrewer extends AContainer {
private static final Map potionRecipes = new EnumMap<>(Material.class);
private static final Map fermentations = new EnumMap<>(PotionType.class);
@@ -143,7 +145,7 @@ public abstract class AutoBrewer extends AContainer {
*
* @return Whether this {@link Material} is a valid potion
*/
- private boolean isPotion(Material mat) {
+ private boolean isPotion(@Nonnull Material mat) {
return mat == Material.POTION || mat == Material.SPLASH_POTION || mat == Material.LINGERING_POTION;
}
@@ -152,18 +154,8 @@ public abstract class AutoBrewer extends AContainer {
return new ItemStack(Material.FISHING_ROD);
}
- @Override
- public int getEnergyConsumption() {
- return 6;
- }
-
@Override
public String getMachineIdentifier() {
return "AUTO_BREWER";
}
-
- @Override
- public int getCapacity() {
- return 128;
- }
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoDisenchanter.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoDisenchanter.java
index f023a42ac..87183a6e3 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoDisenchanter.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoDisenchanter.java
@@ -51,16 +51,6 @@ public class AutoDisenchanter extends AContainer {
return new ItemStack(Material.DIAMOND_CHESTPLATE);
}
- @Override
- public int getEnergyConsumption() {
- return 9;
- }
-
- @Override
- public int getCapacity() {
- return 128;
- }
-
@Override
protected MachineRecipe findNextRecipe(BlockMenu menu) {
Map enchantments = new HashMap<>();
@@ -158,11 +148,6 @@ public class AutoDisenchanter extends AContainer {
}
}
- @Override
- public int getSpeed() {
- return 1;
- }
-
@Override
public String getMachineIdentifier() {
return "AUTO_DISENCHANTER";
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoDrier.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoDrier.java
index 82a88da4f..9273af6b4 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoDrier.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoDrier.java
@@ -101,21 +101,6 @@ public class AutoDrier extends AContainer implements RecipeDisplayItem {
return recipeList;
}
- @Override
- public int getEnergyConsumption() {
- return 5;
- }
-
- @Override
- public int getSpeed() {
- return 1;
- }
-
- @Override
- public int getCapacity() {
- return 128;
- }
-
@Override
public String getMachineIdentifier() {
return "AUTO_DRIER";
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoEnchanter.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoEnchanter.java
index 95a3c8c68..e72dd1e6b 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoEnchanter.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoEnchanter.java
@@ -37,16 +37,6 @@ public class AutoEnchanter extends AContainer {
return new ItemStack(Material.GOLDEN_CHESTPLATE);
}
- @Override
- public int getEnergyConsumption() {
- return 9;
- }
-
- @Override
- public int getCapacity() {
- return 128;
- }
-
@Override
protected MachineRecipe findNextRecipe(BlockMenu menu) {
for (int slot : getInputSlots()) {
@@ -128,11 +118,6 @@ public class AutoEnchanter extends AContainer {
return sfItem == null || sfItem.isEnchantable();
}
- @Override
- public int getSpeed() {
- return 1;
- }
-
@Override
public String getMachineIdentifier() {
return "AUTO_ENCHANTER";
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/CarbonPress.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/CarbonPress.java
index 943102bf0..d6403c373 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/CarbonPress.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/CarbonPress.java
@@ -11,7 +11,7 @@ import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
-public abstract class CarbonPress extends AContainer implements RecipeDisplayItem {
+public class CarbonPress extends AContainer implements RecipeDisplayItem {
public CarbonPress(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ChargingBench.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ChargingBench.java
index eb531682e..16e35d14a 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ChargingBench.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ChargingBench.java
@@ -32,16 +32,6 @@ public class ChargingBench extends AContainer {
return new ItemStack(Material.GOLDEN_PICKAXE);
}
- @Override
- public int getEnergyConsumption() {
- return 10;
- }
-
- @Override
- public int getCapacity() {
- return 128;
- }
-
@Override
protected void tick(Block b) {
if (getCharge(b.getLocation()) < getEnergyConsumption()) {
@@ -81,11 +71,6 @@ public class ChargingBench extends AContainer {
return false;
}
- @Override
- public int getSpeed() {
- return 1;
- }
-
@Override
public String getMachineIdentifier() {
return "CHARGING_BENCH";
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricDustWasher.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricDustWasher.java
index 4c0511710..9d349b87f 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricDustWasher.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricDustWasher.java
@@ -14,7 +14,7 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecip
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
-public abstract class ElectricDustWasher extends AContainer {
+public class ElectricDustWasher extends AContainer {
private OreWasher oreWasher;
private final boolean legacyMode;
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricFurnace.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricFurnace.java
index 91cdfdca8..8d70af663 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricFurnace.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricFurnace.java
@@ -12,7 +12,7 @@ import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
-public abstract class ElectricFurnace extends AContainer {
+public class ElectricFurnace extends AContainer {
public ElectricFurnace(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricGoldPan.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricGoldPan.java
index 11422c220..fd79a5429 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricGoldPan.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricGoldPan.java
@@ -17,7 +17,7 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecip
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
-public abstract class ElectricGoldPan extends AContainer implements RecipeDisplayItem {
+public class ElectricGoldPan extends AContainer implements RecipeDisplayItem {
private final GoldPan goldPan = (GoldPan) SlimefunItems.GOLD_PAN.getItem();
private final GoldPan netherGoldPan = (GoldPan) SlimefunItems.NETHER_GOLD_PAN.getItem();
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricIngotFactory.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricIngotFactory.java
index d3be5e64b..bd60af9c9 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricIngotFactory.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricIngotFactory.java
@@ -9,7 +9,7 @@ import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
-public abstract class ElectricIngotFactory extends AContainer implements RecipeDisplayItem {
+public class ElectricIngotFactory extends AContainer implements RecipeDisplayItem {
public ElectricIngotFactory(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricIngotPulverizer.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricIngotPulverizer.java
index 36056dd21..1fe511565 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricIngotPulverizer.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricIngotPulverizer.java
@@ -53,21 +53,6 @@ public class ElectricIngotPulverizer extends AContainer implements RecipeDisplay
registerRecipe(3, new ItemStack(Material.GOLD_INGOT), SlimefunItems.GOLD_DUST);
}
- @Override
- public int getEnergyConsumption() {
- return 7;
- }
-
- @Override
- public int getSpeed() {
- return 1;
- }
-
- @Override
- public int getCapacity() {
- return 512;
- }
-
@Override
public String getMachineIdentifier() {
return "ELECTRIC_INGOT_PULVERIZER";
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricOreGrinder.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricOreGrinder.java
index a216e7abd..50187ea92 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricOreGrinder.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricOreGrinder.java
@@ -9,7 +9,7 @@ import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
-public abstract class ElectricOreGrinder extends AContainer implements RecipeDisplayItem {
+public class ElectricOreGrinder extends AContainer implements RecipeDisplayItem {
public ElectricOreGrinder(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricPress.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricPress.java
index 334985e7a..eac1bcea2 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricPress.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricPress.java
@@ -11,7 +11,7 @@ import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
-public abstract class ElectricPress extends AContainer implements RecipeDisplayItem {
+public class ElectricPress extends AContainer implements RecipeDisplayItem {
public ElectricPress(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricSmeltery.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricSmeltery.java
index 1f3393bd9..4848b0514 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricSmeltery.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricSmeltery.java
@@ -35,7 +35,7 @@ import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow;
* @author TheBusyBiscuit
*
*/
-public abstract class ElectricSmeltery extends AContainer {
+public class ElectricSmeltery extends AContainer {
private static final int[] border = { 4, 5, 6, 7, 8, 13, 31, 40, 41, 42, 43, 44 };
private static final int[] inputBorder = { 0, 1, 2, 3, 9, 12, 18, 21, 27, 30, 36, 37, 38, 39 };
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java
index e26b0c9ea..2bcd949f0 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java
@@ -12,7 +12,7 @@ import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
-public abstract class ElectrifiedCrucible extends AContainer {
+public class ElectrifiedCrucible extends AContainer {
public ElectrifiedCrucible(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
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 a7ef3c4b8..1c4273544 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
@@ -11,7 +11,7 @@ import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
-public abstract class FoodComposter extends AContainer implements RecipeDisplayItem {
+public class FoodComposter extends AContainer implements RecipeDisplayItem {
public FoodComposter(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
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 ecc8a3e2a..50e9df09a 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
@@ -10,7 +10,7 @@ import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
-public abstract class FoodFabricator extends AContainer {
+public class FoodFabricator extends AContainer {
public FoodFabricator(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/Freezer.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/Freezer.java
index b04851e48..009d89471 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/Freezer.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/Freezer.java
@@ -14,7 +14,7 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
-public abstract class Freezer extends AContainer implements RecipeDisplayItem {
+public class Freezer extends AContainer implements RecipeDisplayItem {
public Freezer(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
@@ -52,9 +52,4 @@ public abstract class Freezer extends AContainer implements RecipeDisplayItem {
return "FREEZER";
}
- @Override
- public int getCapacity() {
- return 256;
- }
-
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/HeatedPressureChamber.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/HeatedPressureChamber.java
index fac111195..d013afb02 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/HeatedPressureChamber.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/HeatedPressureChamber.java
@@ -23,7 +23,7 @@ import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
import me.mrCookieSlime.Slimefun.api.inventory.DirtyChestMenu;
import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow;
-public abstract class HeatedPressureChamber extends AContainer {
+public class HeatedPressureChamber extends AContainer {
public HeatedPressureChamber(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/Refinery.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/Refinery.java
index 721f7f3ee..682a8e3eb 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/Refinery.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/Refinery.java
@@ -10,7 +10,7 @@ import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
-public abstract class Refinery extends AContainer implements RecipeDisplayItem {
+public class Refinery extends AContainer implements RecipeDisplayItem {
public Refinery(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/geo/GEOMiner.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/geo/GEOMiner.java
index 637d5b941..ca0cc1162 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/geo/GEOMiner.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/geo/GEOMiner.java
@@ -30,7 +30,7 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
-public abstract class GEOMiner extends AContainer implements RecipeDisplayItem {
+public class GEOMiner extends AContainer implements RecipeDisplayItem {
private static final int[] BORDER = { 0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 26, 27, 35, 36, 44, 45, 53 };
private static final int[] OUTPUT_BORDER = { 19, 20, 21, 22, 23, 24, 25, 28, 34, 37, 43, 46, 47, 48, 49, 50, 51, 52 };
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/geo/OilPump.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/geo/OilPump.java
index 11ccc1763..fb4bfe1c0 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/geo/OilPump.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/geo/OilPump.java
@@ -25,7 +25,7 @@ import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow;
-public abstract class OilPump extends AContainer implements RecipeDisplayItem {
+public class OilPump extends AContainer implements RecipeDisplayItem {
private final GEOResource oil;
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/EnderTalisman.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/EnderTalisman.java
index ee66d564f..296b423c1 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/EnderTalisman.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/EnderTalisman.java
@@ -1,5 +1,7 @@
package io.github.thebusybiscuit.slimefun4.implementation.items.magical.talismans;
+import javax.annotation.ParametersAreNonnullByDefault;
+
import org.bukkit.NamespacedKey;
import org.bukkit.block.EnderChest;
import org.bukkit.inventory.ItemStack;
@@ -21,12 +23,13 @@ class EnderTalisman extends Talisman {
private static final LockedCategory ENDER_TALISMANS_CATEGORY = new LockedCategory(new NamespacedKey(SlimefunPlugin.instance(), "ender_talismans"), new CustomItem(SlimefunItems.ENDER_TALISMAN, "&7Talismans - &aTier II"), 3, Talisman.TALISMANS_CATEGORY.getKey());
+ @ParametersAreNonnullByDefault
public EnderTalisman(Talisman parent, SlimefunItemStack item) {
super(ENDER_TALISMANS_CATEGORY, item, new ItemStack[] { SlimefunItems.ENDER_LUMP_3, null, SlimefunItems.ENDER_LUMP_3, null, parent.getItem(), null, SlimefunItems.ENDER_LUMP_3, null, SlimefunItems.ENDER_LUMP_3 }, parent.isConsumable(), parent.isEventCancelled(), parent.getMessageSuffix(), parent.getChance(), parent.getEffects());
}
@Override
- public void createEnderTalisman() {
+ void loadEnderTalisman() {
// Let's override that, otherwise we would be creating Ender Talismans
// for every Ender Talisman
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java
index 29a819f04..0909fb3f4 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java
@@ -7,8 +7,13 @@ import java.util.concurrent.ThreadLocalRandom;
import java.util.logging.Level;
import java.util.stream.Collectors;
-import org.bukkit.Material;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import javax.annotation.ParametersAreNonnullByDefault;
+
+import org.apache.commons.lang.Validate;
import org.bukkit.enchantments.Enchantment;
+import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.slimefun4.api.items.ItemSetting;
@@ -16,10 +21,18 @@ import io.github.thebusybiscuit.slimefun4.implementation.settings.TalismanEnchan
import me.mrCookieSlime.Slimefun.api.Slimefun;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
+/**
+ * The {@link MagicianTalisman} is a special kind of {@link Talisman} which awards a {@link Player}
+ * with an extra {@link Enchantment} when they enchant their {@link ItemStack}.
+ *
+ * @author TheBusyBiscuit
+ *
+ */
public class MagicianTalisman extends Talisman {
private final Set enchantments = new HashSet<>();
+ @ParametersAreNonnullByDefault
public MagicianTalisman(SlimefunItemStack item, ItemStack[] recipe) {
super(item, recipe, false, false, "magician", 80);
@@ -47,13 +60,31 @@ public class MagicianTalisman extends Talisman {
*
* @return An applicable {@link TalismanEnchantment} or null
*/
- public TalismanEnchantment getRandomEnchantment(ItemStack item) {
- if (item == null || item.getType() == Material.AIR) {
- return null;
- }
+ @Nullable
+ public TalismanEnchantment getRandomEnchantment(@Nonnull ItemStack item, @Nonnull Set existingEnchantments) {
+ Validate.notNull(item, "The ItemStack cannot be null");
+ Validate.notNull(existingEnchantments, "The Enchantments Set cannot be null");
+
+ // @formatter:off
+ List enabled = enchantments.stream()
+ .filter(e -> e.getEnchantment().canEnchantItem(item))
+ .filter(e -> hasConflicts(existingEnchantments, e))
+ .filter(TalismanEnchantment::getValue)
+ .collect(Collectors.toList());
+ // @formatter:on
- List enabled = enchantments.stream().filter(e -> e.getEnchantment().canEnchantItem(item)).filter(TalismanEnchantment::getValue).collect(Collectors.toList());
return enabled.isEmpty() ? null : enabled.get(ThreadLocalRandom.current().nextInt(enabled.size()));
}
+ @ParametersAreNonnullByDefault
+ private boolean hasConflicts(Set enchantments, TalismanEnchantment ench) {
+ for (Enchantment existing : enchantments) {
+ if (existing.conflictsWith(ench.getEnchantment())) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/Talisman.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/Talisman.java
index bbca533ed..335f4d4e2 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/Talisman.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/Talisman.java
@@ -5,6 +5,10 @@ import java.util.List;
import java.util.Optional;
import java.util.concurrent.ThreadLocalRandom;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import javax.annotation.ParametersAreNonnullByDefault;
+
import org.bukkit.ChatColor;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.Player;
@@ -44,19 +48,23 @@ public class Talisman extends SlimefunItem {
protected final PotionEffect[] effects;
protected final int chance;
- public Talisman(SlimefunItemStack item, ItemStack[] recipe, boolean consumable, boolean cancelEvent, String messageSuffix, PotionEffect... effects) {
+ @ParametersAreNonnullByDefault
+ public Talisman(SlimefunItemStack item, ItemStack[] recipe, boolean consumable, boolean cancelEvent, @Nullable String messageSuffix, PotionEffect... effects) {
this(item, recipe, consumable, cancelEvent, messageSuffix, 100, effects);
}
- public Talisman(SlimefunItemStack item, ItemStack[] recipe, String messageSuffix, int chance, PotionEffect... effects) {
+ @ParametersAreNonnullByDefault
+ public Talisman(SlimefunItemStack item, ItemStack[] recipe, @Nullable String messageSuffix, int chance, PotionEffect... effects) {
this(item, recipe, true, true, messageSuffix, chance, effects);
}
- public Talisman(SlimefunItemStack item, ItemStack[] recipe, boolean consumable, boolean cancelEvent, String messageSuffix, int chance, PotionEffect... effects) {
+ @ParametersAreNonnullByDefault
+ public Talisman(SlimefunItemStack item, ItemStack[] recipe, boolean consumable, boolean cancelEvent, @Nullable String messageSuffix, int chance, PotionEffect... effects) {
this(TALISMANS_CATEGORY, item, recipe, consumable, cancelEvent, messageSuffix, chance, effects);
}
- protected Talisman(Category category, SlimefunItemStack item, ItemStack[] recipe, boolean consumable, boolean cancelEvent, String messageSuffix, int chance, PotionEffect... effects) {
+ @ParametersAreNonnullByDefault
+ protected Talisman(Category category, SlimefunItemStack item, ItemStack[] recipe, boolean consumable, boolean cancelEvent, @Nullable String messageSuffix, int chance, PotionEffect... effects) {
super(category, item, RecipeType.MAGIC_WORKBENCH, recipe, new CustomItem(item, consumable ? 4 : 1));
this.consumable = consumable;
@@ -81,14 +89,26 @@ public class Talisman extends SlimefunItem {
}
}
+ /**
+ * This returns whether the {@link Talisman} will be consumed upon use.
+ *
+ * @return Whether this {@link Talisman} is consumed on use.
+ */
public boolean isConsumable() {
return consumable;
}
+ /**
+ * This returns the chance of this {@link Talisman} activating.
+ * The chance will be between 1 and 100.
+ *
+ * @return The chance of this {@link Talisman} activating.
+ */
public int getChance() {
return chance;
}
+ @Nonnull
public PotionEffect[] getEffects() {
return effects;
}
@@ -101,6 +121,7 @@ public class Talisman extends SlimefunItem {
return cancel;
}
+ @Nullable
private SlimefunItemStack getEnderVariant() {
return enderTalisman;
}
@@ -114,10 +135,10 @@ public class Talisman extends SlimefunItem {
@Override
public void load() {
super.load();
- createEnderTalisman();
+ loadEnderTalisman();
}
- protected void createEnderTalisman() {
+ void loadEnderTalisman() {
EnderTalisman talisman = (EnderTalisman) SlimefunItem.getByItem(getEnderVariant());
Optional research = Research.getResearch(new NamespacedKey(SlimefunPlugin.instance(), "ender_talismans"));
@@ -126,14 +147,16 @@ public class Talisman extends SlimefunItem {
}
}
- private static boolean hasMessage(Talisman talisman) {
+ private static boolean hasMessage(@Nonnull Talisman talisman) {
return talisman.getMessageSuffix() != null;
}
+ @ParametersAreNonnullByDefault
public static boolean checkFor(Event e, SlimefunItemStack stack) {
return checkFor(e, stack.getItem());
}
+ @ParametersAreNonnullByDefault
public static boolean checkFor(Event e, SlimefunItem item) {
if (!(item instanceof Talisman)) {
return false;
@@ -153,7 +176,7 @@ public class Talisman extends SlimefunItem {
if (SlimefunUtils.containsSimilarItem(p.getInventory(), talismanItem, true)) {
if (Slimefun.hasUnlocked(p, talisman, true)) {
- activateTalisman(e, p, p.getInventory(), talisman);
+ activateTalisman(e, p, p.getInventory(), talisman, talismanItem);
return true;
} else {
return false;
@@ -163,7 +186,7 @@ public class Talisman extends SlimefunItem {
if (SlimefunUtils.containsSimilarItem(p.getEnderChest(), enderTalisman, true)) {
if (Slimefun.hasUnlocked(p, talisman, true)) {
- activateTalisman(e, p, p.getEnderChest(), talisman);
+ activateTalisman(e, p, p.getEnderChest(), talisman, enderTalisman);
return true;
} else {
return false;
@@ -174,38 +197,43 @@ public class Talisman extends SlimefunItem {
}
}
- private static void activateTalisman(Event e, Player p, Inventory inv, Talisman talisman) {
- consumeItem(inv, talisman);
+ @ParametersAreNonnullByDefault
+ private static void activateTalisman(Event e, Player p, Inventory inv, Talisman talisman, ItemStack talismanItem) {
+ consumeItem(inv, talisman, talismanItem);
applyTalismanEffects(p, talisman);
cancelEvent(e, talisman);
sendMessage(p, talisman);
}
+ @ParametersAreNonnullByDefault
private static void applyTalismanEffects(Player p, Talisman talisman) {
for (PotionEffect effect : talisman.getEffects()) {
p.addPotionEffect(effect);
}
}
+ @ParametersAreNonnullByDefault
private static void cancelEvent(Event e, Talisman talisman) {
if (e instanceof Cancellable && talisman.isEventCancelled()) {
((Cancellable) e).setCancelled(true);
}
}
+ @ParametersAreNonnullByDefault
private static void sendMessage(Player p, Talisman talisman) {
if (hasMessage(talisman)) {
SlimefunPlugin.getLocalization().sendMessage(p, "messages.talisman." + talisman.getMessageSuffix(), true);
}
}
- private static void consumeItem(Inventory inv, Talisman talisman) {
+ @ParametersAreNonnullByDefault
+ private static void consumeItem(Inventory inv, Talisman talisman, ItemStack talismanItem) {
if (talisman.isConsumable()) {
ItemStack[] contents = inv.getContents();
for (int i = 0; i < contents.length; i++) {
ItemStack item = contents[i];
- if (SlimefunUtils.isItemSimilar(item, talisman.getItem(), true, false)) {
+ if (SlimefunUtils.isItemSimilar(item, talismanItem, true, false)) {
ItemUtils.consumeItem(item, false);
return;
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/ArmorForge.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/ArmorForge.java
index 1cb865b36..608a0e2f5 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/ArmorForge.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/ArmorForge.java
@@ -2,6 +2,8 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.multiblocks;
import java.util.List;
+import javax.annotation.ParametersAreNonnullByDefault;
+
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
@@ -14,7 +16,6 @@ import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
-import io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlockMachine;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
import io.papermc.lib.PaperLib;
@@ -23,7 +24,7 @@ import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.api.Slimefun;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
-public class ArmorForge extends MultiBlockMachine {
+public class ArmorForge extends BackpackCrafter {
public ArmorForge(Category category, SlimefunItemStack item) {
super(category, item, new ItemStack[] { null, null, null, null, new ItemStack(Material.ANVIL), null, null, new CustomItem(Material.DISPENSER, "Dispenser (Facing up)"), null }, BlockFace.SELF);
@@ -31,8 +32,8 @@ public class ArmorForge extends MultiBlockMachine {
@Override
public void onInteract(Player p, Block b) {
- Block dispBlock = b.getRelative(BlockFace.DOWN);
- BlockState state = PaperLib.getBlockState(dispBlock, false).getState();
+ Block dispenser = b.getRelative(BlockFace.DOWN);
+ BlockState state = PaperLib.getBlockState(dispenser, false).getState();
if (state instanceof Dispenser) {
Dispenser disp = (Dispenser) state;
@@ -44,13 +45,7 @@ public class ArmorForge extends MultiBlockMachine {
ItemStack output = RecipeType.getRecipeOutputList(this, inputs.get(i)).clone();
if (Slimefun.hasUnlocked(p, output, true)) {
- Inventory outputInv = findOutputInventory(output, dispBlock, inv);
-
- if (outputInv != null) {
- craft(p, output, inv, outputInv);
- } else {
- SlimefunPlugin.getLocalization().sendMessage(p, "machines.full-inventory", true);
- }
+ craft(p, output, inv, dispenser);
}
return;
@@ -71,26 +66,35 @@ public class ArmorForge extends MultiBlockMachine {
return true;
}
- private void craft(Player p, ItemStack output, Inventory inv, Inventory outputInv) {
- for (int j = 0; j < 9; j++) {
- ItemStack item = inv.getContents()[j];
+ @ParametersAreNonnullByDefault
+ private void craft(Player p, ItemStack output, Inventory inv, Block dispenser) {
+ Inventory fakeInv = createVirtualInventory(inv);
+ Inventory outputInv = findOutputInventory(output, dispenser, inv, fakeInv);
- if (item != null && item.getType() != Material.AIR) {
- ItemUtils.consumeItem(item, true);
- }
- }
+ if (outputInv != null) {
+ for (int j = 0; j < 9; j++) {
+ ItemStack item = inv.getContents()[j];
- for (int j = 0; j < 4; j++) {
- int current = j;
-
- SlimefunPlugin.runSync(() -> {
- if (current < 3) {
- p.getWorld().playSound(p.getLocation(), Sound.BLOCK_ANVIL_USE, 1F, 2F);
- } else {
- p.getWorld().playSound(p.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 1F, 1F);
- outputInv.addItem(output);
+ if (item != null && item.getType() != Material.AIR) {
+ ItemUtils.consumeItem(item, true);
}
- }, j * 20L);
+ }
+
+ for (int j = 0; j < 4; j++) {
+ int current = j;
+
+ SlimefunPlugin.runSync(() -> {
+ if (current < 3) {
+ p.getWorld().playSound(p.getLocation(), Sound.BLOCK_ANVIL_USE, 1F, 2F);
+ } else {
+ p.getWorld().playSound(p.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 1F, 1F);
+ outputInv.addItem(output);
+ }
+ }, j * 20L);
+ }
+
+ } else {
+ SlimefunPlugin.getLocalization().sendMessage(p, "machines.full-inventory", true);
}
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/BackpackCrafter.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/BackpackCrafter.java
index 1a7615221..baf52187a 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/BackpackCrafter.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/BackpackCrafter.java
@@ -32,6 +32,7 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
*
* @see EnhancedCraftingTable
* @see MagicWorkbench
+ * @see ArmorForge
*
*/
abstract class BackpackCrafter extends MultiBlockMachine {
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/CoolerListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/CoolerListener.java
index c54f501d2..5b28f4d81 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/CoolerListener.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/CoolerListener.java
@@ -15,6 +15,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.PotionEffect;
+import io.github.thebusybiscuit.slimefun4.api.events.CoolerFeedPlayerEvent;
import io.github.thebusybiscuit.slimefun4.api.player.PlayerBackpack;
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
@@ -37,11 +38,13 @@ import me.mrCookieSlime.Slimefun.api.Slimefun;
*/
public class CoolerListener implements Listener {
+ private final SlimefunPlugin plugin;
private final Cooler cooler;
public CoolerListener(@Nonnull SlimefunPlugin plugin, @Nonnull Cooler cooler) {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
+ this.plugin = plugin;
this.cooler = cooler;
}
@@ -93,12 +96,12 @@ public class CoolerListener implements Listener {
private void takeJuiceFromCooler(@Nonnull Player p, @Nonnull ItemStack cooler) {
PlayerProfile.getBackpack(cooler, backpack -> {
if (backpack != null) {
- SlimefunPlugin.runSync(() -> consumeJuice(p, backpack));
+ SlimefunPlugin.runSync(() -> consumeJuice(p, cooler, backpack));
}
});
}
- private boolean consumeJuice(@Nonnull Player p, @Nonnull PlayerBackpack backpack) {
+ private boolean consumeJuice(@Nonnull Player p, @Nonnull ItemStack coolerItem, @Nonnull PlayerBackpack backpack) {
Inventory inv = backpack.getInventory();
int slot = -1;
@@ -112,17 +115,26 @@ public class CoolerListener implements Listener {
}
if (slot >= 0) {
- PotionMeta im = (PotionMeta) inv.getItem(slot).getItemMeta();
+ ItemStack item = inv.getItem(slot);
+ CoolerFeedPlayerEvent event = new CoolerFeedPlayerEvent(p, cooler, coolerItem, item);
+ plugin.getServer().getPluginManager().callEvent(event);
- for (PotionEffect effect : im.getCustomEffects()) {
- p.addPotionEffect(effect);
+ if (!event.isCancelled()) {
+ PotionMeta im = (PotionMeta) event.getConsumedItem().getItemMeta();
+
+ for (PotionEffect effect : im.getCustomEffects()) {
+ p.addPotionEffect(effect);
+ }
+
+ p.setSaturation(6F);
+ p.playSound(p.getLocation(), Sound.ENTITY_GENERIC_DRINK, 1F, 1F);
+ inv.setItem(slot, null);
+ backpack.markDirty();
+
+ return true;
+ } else {
+ return false;
}
-
- p.setSaturation(6F);
- p.playSound(p.getLocation(), Sound.ENTITY_GENERIC_DRINK, 1F, 1F);
- inv.setItem(slot, null);
- backpack.markDirty();
- return true;
}
return false;
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunBootsListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunBootsListener.java
index a84e4e027..5abb1160b 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunBootsListener.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/SlimefunBootsListener.java
@@ -40,15 +40,19 @@ public class SlimefunBootsListener implements Listener {
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onDamage(EntityDamageEvent e) {
- if (e.getEntity() instanceof Player) {
- if (e.getCause() == DamageCause.FALL) {
- onFallDamage(e);
- } else if (e instanceof EntityDamageByEntityEvent) {
- EntityDamageByEntityEvent event = (EntityDamageByEntityEvent) e;
+ if (e.getEntity() instanceof Player && e.getCause() == DamageCause.FALL) {
+ onFallDamage(e);
+ }
+ }
- if (event.getDamager() instanceof EnderPearl) {
- onEnderPearlDamage(e);
- }
+ @EventHandler
+ public void onEnderPearlDamage(EntityDamageByEntityEvent e) {
+ if (e.getDamager() instanceof EnderPearl && e.getEntity() instanceof Player) {
+ Player p = (Player) e.getEntity();
+ SlimefunItem boots = SlimefunItem.getByItem(p.getInventory().getBoots());
+
+ if (boots != null && boots.getId().equals("ENDER_BOOTS") && Slimefun.hasUnlocked(p, boots, true)) {
+ e.setCancelled(true);
}
}
}
@@ -75,15 +79,6 @@ public class SlimefunBootsListener implements Listener {
}
}
- private void onEnderPearlDamage(@Nonnull EntityDamageEvent e) {
- Player p = (Player) e.getEntity();
- SlimefunItem boots = SlimefunItem.getByItem(p.getInventory().getBoots());
-
- if (boots != null && boots.getId().equals("ENDER_BOOTS") && Slimefun.hasUnlocked(p, boots, true)) {
- e.setCancelled(true);
- }
- }
-
@EventHandler
public void onTrample(PlayerInteractEvent e) {
if (e.getAction() == Action.PHYSICAL) {
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java
index 531bf9206..e895b9105 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java
@@ -3,8 +3,8 @@ package io.github.thebusybiscuit.slimefun4.implementation.listeners;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.Map;
import java.util.Random;
-import java.util.Set;
import java.util.concurrent.ThreadLocalRandom;
import javax.annotation.Nonnull;
@@ -231,26 +231,28 @@ public class TalismanListener implements Listener {
@EventHandler
public void onEnchant(EnchantItemEvent e) {
Random random = ThreadLocalRandom.current();
+ Map enchantments = e.getEnchantsToAdd();
+ // Magician Talisman
if (Talisman.checkFor(e, SlimefunItems.TALISMAN_MAGICIAN)) {
MagicianTalisman talisman = (MagicianTalisman) SlimefunItems.TALISMAN_MAGICIAN.getItem();
- TalismanEnchantment enchantment = talisman.getRandomEnchantment(e.getItem());
+ TalismanEnchantment enchantment = talisman.getRandomEnchantment(e.getItem(), enchantments.keySet());
if (enchantment != null) {
- e.getEnchantsToAdd().put(enchantment.getEnchantment(), enchantment.getLevel());
+ enchantments.put(enchantment.getEnchantment(), enchantment.getLevel());
}
}
- if (!e.getEnchantsToAdd().containsKey(Enchantment.SILK_TOUCH) && Enchantment.LOOT_BONUS_BLOCKS.canEnchantItem(e.getItem()) && Talisman.checkFor(e, SlimefunItems.TALISMAN_WIZARD)) {
- Set enchantments = e.getEnchantsToAdd().keySet();
+ // Wizard Talisman
+ if (!enchantments.containsKey(Enchantment.SILK_TOUCH) && Enchantment.LOOT_BONUS_BLOCKS.canEnchantItem(e.getItem()) && Talisman.checkFor(e, SlimefunItems.TALISMAN_WIZARD)) {
- for (Enchantment enchantment : enchantments) {
+ for (Enchantment enchantment : enchantments.keySet()) {
if (random.nextInt(100) < 40) {
e.getEnchantsToAdd().put(enchantment, random.nextInt(3) + 1);
}
}
- e.getEnchantsToAdd().put(Enchantment.LOOT_BONUS_BLOCKS, random.nextInt(3) + 3);
+ enchantments.put(Enchantment.LOOT_BONUS_BLOCKS, random.nextInt(3) + 3);
}
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/crafting/AnvilListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/crafting/AnvilListener.java
index 4df3a82eb..912c1804f 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/crafting/AnvilListener.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/crafting/AnvilListener.java
@@ -2,7 +2,6 @@ package io.github.thebusybiscuit.slimefun4.implementation.listeners.crafting;
import javax.annotation.Nonnull;
-import org.bukkit.block.BrewingStand;
import org.bukkit.entity.Player;
import org.bukkit.event.Event.Result;
import org.bukkit.event.EventHandler;
@@ -15,8 +14,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
/**
- * This {@link Listener} prevents any {@link SlimefunItem} from being used in a
- * {@link BrewingStand}.
+ * This {@link Listener} prevents any {@link SlimefunItem} from being used in an
+ * anvil.
*
* @author TheBusyBiscuit
*
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/crafting/BrewingStandListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/crafting/BrewingStandListener.java
index 60a4594af..9f3d40f2f 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/crafting/BrewingStandListener.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/crafting/BrewingStandListener.java
@@ -17,7 +17,7 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
/**
* This {@link Listener} prevents any {@link SlimefunItem} from being used in a
- * {@link BrewingStand}.
+ * brewing stand.
*
* @author VoidAngel
* @author SoSeDiK
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/settings/TalismanEnchantment.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/settings/TalismanEnchantment.java
index 74681d9c6..c67a198da 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/settings/TalismanEnchantment.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/settings/TalismanEnchantment.java
@@ -21,7 +21,7 @@ public class TalismanEnchantment extends ItemSetting {
private final int level;
public TalismanEnchantment(@Nonnull Enchantment enchantment, int level) {
- super("allow-enchantments." + enchantment.getKey().getKey() + ".level." + level, true);
+ super("allow-enchantments." + enchantment.getKey().getNamespace() + '.' + enchantment.getKey().getKey() + ".level." + level, true);
this.enchantment = enchantment;
this.level = level;
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 d8e27ff80..4af030dec 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
@@ -192,7 +192,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.weapons.IcyBow;
import io.github.thebusybiscuit.slimefun4.implementation.items.weapons.SeismicAxe;
import io.github.thebusybiscuit.slimefun4.implementation.items.weapons.SwordOfBeheading;
import io.github.thebusybiscuit.slimefun4.implementation.items.weapons.VampireBlade;
-import io.github.thebusybiscuit.slimefun4.utils.ColoredMaterials;
+import io.github.thebusybiscuit.slimefun4.utils.ColoredMaterial;
import io.github.thebusybiscuit.slimefun4.utils.HeadTexture;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
@@ -206,7 +206,7 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
*
*/
public final class SlimefunItemSetup {
-
+
private static boolean registeredItems = false;
private SlimefunItemSetup() {}
@@ -218,7 +218,8 @@ public final class SlimefunItemSetup {
registeredItems = true;
DefaultCategories categories = new DefaultCategories();
-
+
+ // @formatter:off (We will need to refactor this one day)
new SlimefunItem(categories.weapons, SlimefunItems.GRANDMAS_WALKING_STICK, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {null, new ItemStack(Material.OAK_LOG), null, null, new ItemStack(Material.OAK_LOG), null, null, new ItemStack(Material.OAK_LOG), null})
.register(plugin);
@@ -1092,7 +1093,7 @@ public final class SlimefunItemSetup {
new RestoredBackpack(categories.usefulItems).register(plugin);
- new SlimefunItem(categories.technicalComponents, SlimefunItems.MAGNET, RecipeType.SMELTERY,
+ new UnplaceableBlock(categories.technicalComponents, SlimefunItems.MAGNET, RecipeType.SMELTERY,
new ItemStack[] {SlimefunItems.NICKEL_INGOT, SlimefunItems.ALUMINUM_DUST, SlimefunItems.IRON_DUST, SlimefunItems.COBALT_INGOT, null, null, null, null, null})
.register(plugin);
@@ -1303,15 +1304,15 @@ public final class SlimefunItemSetup {
new ItemStack[] {SlimefunItems.CARBONADO, SlimefunItems.BASIC_CIRCUIT_BOARD, SlimefunItems.CARBONADO, SlimefunItems.HEATING_COIL, SlimefunItems.REINFORCED_FURNACE, SlimefunItems.HEATING_COIL, SlimefunItems.CARBONADO, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.CARBONADO})
.register(plugin);
- new SlimefunItem(categories.technicalComponents, SlimefunItems.ELECTRO_MAGNET, RecipeType.ENHANCED_CRAFTING_TABLE,
+ new UnplaceableBlock(categories.technicalComponents, SlimefunItems.ELECTRO_MAGNET, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {SlimefunItems.NICKEL_INGOT, SlimefunItems.MAGNET, SlimefunItems.COBALT_INGOT, null, SlimefunItems.BATTERY, null, null, null, null})
.register(plugin);
- new SlimefunItem(categories.technicalComponents, SlimefunItems.ELECTRIC_MOTOR, RecipeType.ENHANCED_CRAFTING_TABLE,
+ new UnplaceableBlock(categories.technicalComponents, SlimefunItems.ELECTRIC_MOTOR, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {SlimefunItems.COPPER_WIRE, SlimefunItems.COPPER_WIRE, SlimefunItems.COPPER_WIRE, null, SlimefunItems.ELECTRO_MAGNET, null, SlimefunItems.COPPER_WIRE, SlimefunItems.COPPER_WIRE, SlimefunItems.COPPER_WIRE})
.register(plugin);
- new SlimefunItem(categories.technicalComponents, SlimefunItems.HEATING_COIL, RecipeType.ENHANCED_CRAFTING_TABLE,
+ new UnplaceableBlock(categories.technicalComponents, SlimefunItems.HEATING_COIL, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {SlimefunItems.COPPER_WIRE, SlimefunItems.COPPER_WIRE, SlimefunItems.COPPER_WIRE, SlimefunItems.COPPER_WIRE, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.COPPER_WIRE, SlimefunItems.COPPER_WIRE, SlimefunItems.COPPER_WIRE, SlimefunItems.COPPER_WIRE})
.register(plugin);
@@ -1455,7 +1456,7 @@ public final class SlimefunItemSetup {
new SlimefunItemStack(SlimefunItems.HARDENED_GLASS, 16))
.register(plugin);
- new SlimefunItem(categories.technicalComponents, SlimefunItems.COOLING_UNIT, RecipeType.ENHANCED_CRAFTING_TABLE,
+ new UnplaceableBlock(categories.technicalComponents, SlimefunItems.COOLING_UNIT, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {new ItemStack(Material.ICE), new ItemStack(Material.ICE), new ItemStack(Material.ICE), SlimefunItems.ALUMINUM_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ALUMINUM_INGOT, new ItemStack(Material.ICE), new ItemStack(Material.ICE), new ItemStack(Material.ICE)})
.register(plugin);
@@ -1533,547 +1534,234 @@ public final class SlimefunItemSetup {
new ChargingBench(categories.electricity, SlimefunItems.CHARGING_BENCH, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {null, SlimefunItems.ELECTRO_MAGNET, null, SlimefunItems.BATTERY, new ItemStack(Material.CRAFTING_TABLE), SlimefunItems.BATTERY, null, SlimefunItems.SMALL_CAPACITOR, null})
+ .setCapacity(128)
+ .setEnergyConsumption(10)
+ .setProcessingSpeed(1)
.register(plugin);
new ElectricFurnace(categories.electricity, SlimefunItems.ELECTRIC_FURNACE, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {null, new ItemStack(Material.FURNACE), null, SlimefunItems.GILDED_IRON, SlimefunItems.HEATING_COIL, SlimefunItems.GILDED_IRON, SlimefunItems.GILDED_IRON, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.GILDED_IRON}) {
-
- @Override
- public int getEnergyConsumption() {
- return 2;
- }
-
- @Override
- public int getCapacity() {
- return 64;
- }
-
- @Override
- public int getSpeed() {
- return 1;
- }
-
- }.register(plugin);
+ new ItemStack[] {null, new ItemStack(Material.FURNACE), null, SlimefunItems.GILDED_IRON, SlimefunItems.HEATING_COIL, SlimefunItems.GILDED_IRON, SlimefunItems.GILDED_IRON, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.GILDED_IRON})
+ .setCapacity(64)
+ .setEnergyConsumption(2)
+ .setProcessingSpeed(1)
+ .register(plugin);
new ElectricFurnace(categories.electricity, SlimefunItems.ELECTRIC_FURNACE_2, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {null, SlimefunItems.ELECTRIC_MOTOR, null, SlimefunItems.GILDED_IRON, SlimefunItems.ELECTRIC_FURNACE, SlimefunItems.GILDED_IRON, SlimefunItems.GILDED_IRON, SlimefunItems.HEATING_COIL, SlimefunItems.GILDED_IRON}) {
-
- @Override
- public int getEnergyConsumption() {
- return 3;
- }
-
- @Override
- public int getCapacity() {
- return 128;
- }
-
- @Override
- public int getSpeed() {
- return 2;
- }
-
- }.register(plugin);
+ new ItemStack[] {null, SlimefunItems.ELECTRIC_MOTOR, null, SlimefunItems.GILDED_IRON, SlimefunItems.ELECTRIC_FURNACE, SlimefunItems.GILDED_IRON, SlimefunItems.GILDED_IRON, SlimefunItems.HEATING_COIL, SlimefunItems.GILDED_IRON})
+ .setCapacity(128)
+ .setEnergyConsumption(3)
+ .setProcessingSpeed(2)
+ .register(plugin);
new ElectricFurnace(categories.electricity, SlimefunItems.ELECTRIC_FURNACE_3, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {null, SlimefunItems.ELECTRIC_MOTOR, null, SlimefunItems.STEEL_INGOT, SlimefunItems.ELECTRIC_FURNACE_2, SlimefunItems.STEEL_INGOT, SlimefunItems.GILDED_IRON, SlimefunItems.HEATING_COIL, SlimefunItems.GILDED_IRON}) {
-
- @Override
- public int getEnergyConsumption() {
- return 5;
- }
-
- @Override
- public int getCapacity() {
- return 128;
- }
-
- @Override
- public int getSpeed() {
- return 4;
- }
-
- }.register(plugin);
+ new ItemStack[] {null, SlimefunItems.ELECTRIC_MOTOR, null, SlimefunItems.STEEL_INGOT, SlimefunItems.ELECTRIC_FURNACE_2, SlimefunItems.STEEL_INGOT, SlimefunItems.GILDED_IRON, SlimefunItems.HEATING_COIL, SlimefunItems.GILDED_IRON})
+ .setCapacity(128)
+ .setEnergyConsumption(5)
+ .setProcessingSpeed(4)
+ .register(plugin);
new ElectricGoldPan(categories.electricity, SlimefunItems.ELECTRIC_GOLD_PAN, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {null, SlimefunItems.GOLD_PAN, null, new ItemStack(Material.FLINT), SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.FLINT), SlimefunItems.ALUMINUM_INGOT, SlimefunItems.ALUMINUM_INGOT, SlimefunItems.ALUMINUM_INGOT}) {
-
- @Override
- public int getEnergyConsumption() {
- return 1;
- }
-
- @Override
- public int getCapacity() {
- return 128;
- }
-
- @Override
- public int getSpeed() {
- return 1;
- }
-
- }.register(plugin);
+ new ItemStack[] {null, SlimefunItems.GOLD_PAN, null, new ItemStack(Material.FLINT), SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.FLINT), SlimefunItems.ALUMINUM_INGOT, SlimefunItems.ALUMINUM_INGOT, SlimefunItems.ALUMINUM_INGOT})
+ .setCapacity(128)
+ .setEnergyConsumption(1)
+ .setProcessingSpeed(1)
+ .register(plugin);
new ElectricGoldPan(categories.electricity, SlimefunItems.ELECTRIC_GOLD_PAN_2, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {null, SlimefunItems.GOLD_PAN, null, new ItemStack(Material.IRON_INGOT), SlimefunItems.ELECTRIC_GOLD_PAN, new ItemStack(Material.IRON_INGOT), SlimefunItems.DURALUMIN_INGOT, SlimefunItems.DURALUMIN_INGOT, SlimefunItems.DURALUMIN_INGOT}) {
-
- @Override
- public int getEnergyConsumption() {
- return 2;
- }
-
- @Override
- public int getCapacity() {
- return 128;
- }
-
- @Override
- public int getSpeed() {
- return 3;
- }
-
- }.register(plugin);
+ new ItemStack[] {null, SlimefunItems.GOLD_PAN, null, new ItemStack(Material.IRON_INGOT), SlimefunItems.ELECTRIC_GOLD_PAN, new ItemStack(Material.IRON_INGOT), SlimefunItems.DURALUMIN_INGOT, SlimefunItems.DURALUMIN_INGOT, SlimefunItems.DURALUMIN_INGOT})
+ .setCapacity(128)
+ .setEnergyConsumption(2)
+ .setProcessingSpeed(3)
+ .register(plugin);
new ElectricGoldPan(categories.electricity, SlimefunItems.ELECTRIC_GOLD_PAN_3, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {null, SlimefunItems.GOLD_PAN, null, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ELECTRIC_GOLD_PAN_2, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.COBALT_INGOT, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.COBALT_INGOT}) {
-
- @Override
- public int getEnergyConsumption() {
- return 7;
- }
-
- @Override
- public int getCapacity() {
- return 512;
- }
-
- @Override
- public int getSpeed() {
- return 10;
- }
-
- }.register(plugin);
+ new ItemStack[] {null, SlimefunItems.GOLD_PAN, null, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ELECTRIC_GOLD_PAN_2, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.COBALT_INGOT, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.COBALT_INGOT})
+ .setCapacity(512)
+ .setEnergyConsumption(7)
+ .setProcessingSpeed(10)
+ .register(plugin);
new ElectricDustWasher(categories.electricity, SlimefunItems.ELECTRIC_DUST_WASHER, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {null, new ItemStack(Material.WATER_BUCKET), null, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.ELECTRIC_GOLD_PAN, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.COPPER_INGOT, SlimefunItems.COPPER_INGOT, SlimefunItems.COPPER_INGOT}) {
-
- @Override
- public int getEnergyConsumption() {
- return 3;
- }
-
- @Override
- public int getCapacity() {
- return 128;
- }
-
- @Override
- public int getSpeed() {
- return 1;
- }
-
- }.register(plugin);
+ new ItemStack[] {null, new ItemStack(Material.WATER_BUCKET), null, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.ELECTRIC_GOLD_PAN, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.COPPER_INGOT, SlimefunItems.COPPER_INGOT, SlimefunItems.COPPER_INGOT})
+ .setCapacity(128)
+ .setEnergyConsumption(3)
+ .setProcessingSpeed(1)
+ .register(plugin);
new ElectricDustWasher(categories.electricity, SlimefunItems.ELECTRIC_DUST_WASHER_2, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {null, new ItemStack(Material.WATER_BUCKET), null, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.ELECTRIC_DUST_WASHER, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT}) {
-
- @Override
- public int getEnergyConsumption() {
- return 5;
- }
-
- @Override
- public int getCapacity() {
- return 128;
- }
-
- @Override
- public int getSpeed() {
- return 2;
- }
-
- }.register(plugin);
+ new ItemStack[] {null, new ItemStack(Material.WATER_BUCKET), null, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.ELECTRIC_DUST_WASHER, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT})
+ .setCapacity(128)
+ .setEnergyConsumption(5)
+ .setProcessingSpeed(2)
+ .register(plugin);
new ElectricDustWasher(categories.electricity, SlimefunItems.ELECTRIC_DUST_WASHER_3, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {null, new ItemStack(Material.WATER_BUCKET), null, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.ELECTRIC_DUST_WASHER_2, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.CORINTHIAN_BRONZE_INGOT, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.CORINTHIAN_BRONZE_INGOT}) {
-
- @Override
- public int getEnergyConsumption() {
- return 15;
- }
-
- @Override
- public int getCapacity() {
- return 512;
- }
-
- @Override
- public int getSpeed() {
- return 10;
- }
-
- }.register(plugin);
+ new ItemStack[] {null, new ItemStack(Material.WATER_BUCKET), null, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.ELECTRIC_DUST_WASHER_2, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.CORINTHIAN_BRONZE_INGOT, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.CORINTHIAN_BRONZE_INGOT})
+ .setCapacity(512)
+ .setEnergyConsumption(15)
+ .setProcessingSpeed(10)
+ .register(plugin);
new ElectricIngotFactory(categories.electricity, SlimefunItems.ELECTRIC_INGOT_FACTORY, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {null, new ItemStack(Material.FLINT_AND_STEEL), null, SlimefunItems.HEATING_COIL, SlimefunItems.ELECTRIC_DUST_WASHER, SlimefunItems.HEATING_COIL, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.DAMASCUS_STEEL_INGOT}) {
-
- @Override
- public int getEnergyConsumption() {
- return 4;
- }
-
- @Override
- public int getCapacity() {
- return 256;
- }
-
- @Override
- public int getSpeed() {
- return 1;
- }
-
- }.register(plugin);
+ new ItemStack[] {null, new ItemStack(Material.FLINT_AND_STEEL), null, SlimefunItems.HEATING_COIL, SlimefunItems.ELECTRIC_DUST_WASHER, SlimefunItems.HEATING_COIL, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.DAMASCUS_STEEL_INGOT})
+ .setCapacity(256)
+ .setEnergyConsumption(4)
+ .setProcessingSpeed(1)
+ .register(plugin);
new ElectricIngotFactory(categories.electricity, SlimefunItems.ELECTRIC_INGOT_FACTORY_2, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {SlimefunItems.GILDED_IRON, new ItemStack(Material.FLINT_AND_STEEL), SlimefunItems.GILDED_IRON, SlimefunItems.HEATING_COIL, SlimefunItems.ELECTRIC_INGOT_FACTORY, SlimefunItems.HEATING_COIL, SlimefunItems.BRASS_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.BRASS_INGOT}) {
-
- @Override
- public int getEnergyConsumption() {
- return 7;
- }
-
- @Override
- public int getCapacity() {
- return 256;
- }
-
- @Override
- public int getSpeed() {
- return 2;
- }
-
- }.register(plugin);
+ new ItemStack[] {SlimefunItems.GILDED_IRON, new ItemStack(Material.FLINT_AND_STEEL), SlimefunItems.GILDED_IRON, SlimefunItems.HEATING_COIL, SlimefunItems.ELECTRIC_INGOT_FACTORY, SlimefunItems.HEATING_COIL, SlimefunItems.BRASS_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.BRASS_INGOT})
+ .setCapacity(256)
+ .setEnergyConsumption(7)
+ .setProcessingSpeed(2)
+ .register(plugin);
new ElectricIngotFactory(categories.electricity, SlimefunItems.ELECTRIC_INGOT_FACTORY_3, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {SlimefunItems.GILDED_IRON, new ItemStack(Material.FLINT_AND_STEEL), SlimefunItems.GILDED_IRON, SlimefunItems.HEATING_COIL, SlimefunItems.ELECTRIC_INGOT_FACTORY_2, SlimefunItems.HEATING_COIL, SlimefunItems.BRASS_INGOT, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.BRASS_INGOT}) {
-
- @Override
- public int getEnergyConsumption() {
- return 20;
- }
-
- @Override
- public int getCapacity() {
- return 512;
- }
-
- @Override
- public int getSpeed() {
- return 8;
- }
-
- }.register(plugin);
+ new ItemStack[] {SlimefunItems.GILDED_IRON, new ItemStack(Material.FLINT_AND_STEEL), SlimefunItems.GILDED_IRON, SlimefunItems.HEATING_COIL, SlimefunItems.ELECTRIC_INGOT_FACTORY_2, SlimefunItems.HEATING_COIL, SlimefunItems.BRASS_INGOT, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.BRASS_INGOT})
+ .setCapacity(512)
+ .setEnergyConsumption(20)
+ .setProcessingSpeed(8)
+ .register(plugin);
new ElectrifiedCrucible(categories.electricity, SlimefunItems.ELECTRIFIED_CRUCIBLE, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {SlimefunItems.LEAD_INGOT, SlimefunItems.CRUCIBLE, SlimefunItems.LEAD_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.HEATING_COIL, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.LEAD_INGOT, SlimefunItems.LARGE_CAPACITOR, SlimefunItems.LEAD_INGOT}) {
-
- @Override
- public int getEnergyConsumption() {
- return 24;
- }
-
- @Override
- public int getCapacity() {
- return 1024;
- }
-
- @Override
- public int getSpeed() {
- return 1;
- }
-
- }.register(plugin);
+ new ItemStack[] {SlimefunItems.LEAD_INGOT, SlimefunItems.CRUCIBLE, SlimefunItems.LEAD_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.HEATING_COIL, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.LEAD_INGOT, SlimefunItems.LARGE_CAPACITOR, SlimefunItems.LEAD_INGOT})
+ .setCapacity(1024)
+ .setEnergyConsumption(24)
+ .setProcessingSpeed(1)
+ .register(plugin);
new ElectrifiedCrucible(categories.electricity, SlimefunItems.ELECTRIFIED_CRUCIBLE_2, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {SlimefunItems.CORINTHIAN_BRONZE_INGOT, SlimefunItems.ELECTRIFIED_CRUCIBLE, SlimefunItems.CORINTHIAN_BRONZE_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.LEAD_INGOT, SlimefunItems.HEATING_COIL, SlimefunItems.LEAD_INGOT}) {
-
- @Override
- public int getEnergyConsumption() {
- return 40;
- }
-
- @Override
- public int getCapacity() {
- return 1024;
- }
-
- @Override
- public int getSpeed() {
- return 2;
- }
-
- }.register(plugin);
+ new ItemStack[] {SlimefunItems.CORINTHIAN_BRONZE_INGOT, SlimefunItems.ELECTRIFIED_CRUCIBLE, SlimefunItems.CORINTHIAN_BRONZE_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.LEAD_INGOT, SlimefunItems.HEATING_COIL, SlimefunItems.LEAD_INGOT})
+ .setCapacity(1024)
+ .setEnergyConsumption(40)
+ .setProcessingSpeed(2)
+ .register(plugin);
new ElectrifiedCrucible(categories.electricity, SlimefunItems.ELECTRIFIED_CRUCIBLE_3, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {SlimefunItems.CORINTHIAN_BRONZE_INGOT, SlimefunItems.ELECTRIFIED_CRUCIBLE_2, SlimefunItems.CORINTHIAN_BRONZE_INGOT, SlimefunItems.STEEL_PLATE, SlimefunItems.POWER_CRYSTAL, SlimefunItems.STEEL_PLATE, SlimefunItems.LEAD_INGOT, SlimefunItems.LEAD_INGOT, SlimefunItems.LEAD_INGOT}) {
-
- @Override
- public int getEnergyConsumption() {
- return 60;
- }
-
- @Override
- public int getCapacity() {
- return 1024;
- }
-
- @Override
- public int getSpeed() {
- return 4;
- }
-
- }.register(plugin);
+ new ItemStack[] {SlimefunItems.CORINTHIAN_BRONZE_INGOT, SlimefunItems.ELECTRIFIED_CRUCIBLE_2, SlimefunItems.CORINTHIAN_BRONZE_INGOT, SlimefunItems.STEEL_PLATE, SlimefunItems.POWER_CRYSTAL, SlimefunItems.STEEL_PLATE, SlimefunItems.LEAD_INGOT, SlimefunItems.LEAD_INGOT, SlimefunItems.LEAD_INGOT})
+ .setCapacity(1024)
+ .setEnergyConsumption(60)
+ .setProcessingSpeed(4)
+ .register(plugin);
new ElectricOreGrinder(categories.electricity, SlimefunItems.ELECTRIC_ORE_GRINDER, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {null, new ItemStack(Material.DIAMOND_PICKAXE), null, SlimefunItems.GILDED_IRON, SlimefunItems.HEATING_COIL, SlimefunItems.GILDED_IRON, SlimefunItems.GILDED_IRON, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.GILDED_IRON}) {
-
- @Override
- public int getEnergyConsumption() {
- return 6;
- }
-
- @Override
- public int getCapacity() {
- return 128;
- }
-
- @Override
- public int getSpeed() {
- return 1;
- }
-
- }.register(plugin);
+ new ItemStack[] {null, new ItemStack(Material.DIAMOND_PICKAXE), null, SlimefunItems.GILDED_IRON, SlimefunItems.HEATING_COIL, SlimefunItems.GILDED_IRON, SlimefunItems.GILDED_IRON, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.GILDED_IRON})
+ .setCapacity(128)
+ .setEnergyConsumption(6)
+ .setProcessingSpeed(1)
+ .register(plugin);
new ElectricOreGrinder(categories.electricity, SlimefunItems.ELECTRIC_ORE_GRINDER_2, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {null, new ItemStack(Material.DIAMOND_PICKAXE), null, SlimefunItems.HEATING_COIL, SlimefunItems.ELECTRIC_ORE_GRINDER, SlimefunItems.HEATING_COIL, SlimefunItems.GILDED_IRON, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.GILDED_IRON}) {
-
- @Override
- public int getEnergyConsumption() {
- return 15;
- }
-
- @Override
- public int getCapacity() {
- return 512;
- }
-
- @Override
- public int getSpeed() {
- return 4;
- }
-
- }.register(plugin);
+ new ItemStack[] {null, new ItemStack(Material.DIAMOND_PICKAXE), null, SlimefunItems.HEATING_COIL, SlimefunItems.ELECTRIC_ORE_GRINDER, SlimefunItems.HEATING_COIL, SlimefunItems.GILDED_IRON, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.GILDED_IRON})
+ .setCapacity(512)
+ .setEnergyConsumption(15)
+ .setProcessingSpeed(4)
+ .register(plugin);
new HeatedPressureChamber(categories.electricity, SlimefunItems.HEATED_PRESSURE_CHAMBER, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {SlimefunItems.LEAD_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.LEAD_INGOT, SlimefunItems.LEAD_INGOT, new ItemStack(Material.GLASS), SlimefunItems.LEAD_INGOT, SlimefunItems.LEAD_INGOT, SlimefunItems.HEATING_COIL, SlimefunItems.LEAD_INGOT}) {
-
- @Override
- public int getEnergyConsumption() {
- return 5;
- }
-
- @Override
- public int getCapacity() {
- return 128;
- }
-
- @Override
- public int getSpeed() {
- return 1;
- }
-
- }.register(plugin);
+ new ItemStack[] {SlimefunItems.LEAD_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.LEAD_INGOT, SlimefunItems.LEAD_INGOT, new ItemStack(Material.GLASS), SlimefunItems.LEAD_INGOT, SlimefunItems.LEAD_INGOT, SlimefunItems.HEATING_COIL, SlimefunItems.LEAD_INGOT})
+ .setCapacity(128)
+ .setEnergyConsumption(5)
+ .setProcessingSpeed(1)
+ .register(plugin);
new HeatedPressureChamber(categories.electricity, SlimefunItems.HEATED_PRESSURE_CHAMBER_2, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {SlimefunItems.LEAD_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.LEAD_INGOT, SlimefunItems.LEAD_INGOT, SlimefunItems.HEATED_PRESSURE_CHAMBER, SlimefunItems.LEAD_INGOT, SlimefunItems.REINFORCED_ALLOY_INGOT, SlimefunItems.HEATING_COIL, SlimefunItems.REINFORCED_ALLOY_INGOT}) {
-
- @Override
- public int getEnergyConsumption() {
- return 22;
- }
-
- @Override
- public int getCapacity() {
- return 256;
- }
-
- @Override
- public int getSpeed() {
- return 5;
- }
-
- }.register(plugin);
+ new ItemStack[] {SlimefunItems.LEAD_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.LEAD_INGOT, SlimefunItems.LEAD_INGOT, SlimefunItems.HEATED_PRESSURE_CHAMBER, SlimefunItems.LEAD_INGOT, SlimefunItems.REINFORCED_ALLOY_INGOT, SlimefunItems.HEATING_COIL, SlimefunItems.REINFORCED_ALLOY_INGOT})
+ .setCapacity(256)
+ .setEnergyConsumption(22)
+ .setProcessingSpeed(5)
+ .register(plugin);
new ElectricIngotPulverizer(categories.electricity, SlimefunItems.ELECTRIC_INGOT_PULVERIZER, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {null, SlimefunItems.ELECTRIC_ORE_GRINDER, null, SlimefunItems.LEAD_INGOT, SlimefunItems.MEDIUM_CAPACITOR, SlimefunItems.LEAD_INGOT, SlimefunItems.LEAD_INGOT, SlimefunItems.HEATING_COIL, SlimefunItems.LEAD_INGOT})
+ .setCapacity(512)
+ .setEnergyConsumption(7)
+ .setProcessingSpeed(1)
.register(plugin);
new CoalGenerator(categories.electricity, SlimefunItems.COAL_GENERATOR, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {SlimefunItems.HEATING_COIL, new ItemStack(Material.FURNACE), SlimefunItems.HEATING_COIL, SlimefunItems.NICKEL_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.NICKEL_INGOT, null, SlimefunItems.NICKEL_INGOT, null}) {
-
- @Override
- public int getEnergyProduction() {
- return 8;
- }
-
- @Override
- public int getCapacity() {
- return 64;
- }
-
- }.register(plugin);
+ new ItemStack[] {SlimefunItems.HEATING_COIL, new ItemStack(Material.FURNACE), SlimefunItems.HEATING_COIL, SlimefunItems.NICKEL_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.NICKEL_INGOT, null, SlimefunItems.NICKEL_INGOT, null})
+ .setCapacity(64)
+ .setEnergyProduction(8)
+ .register(plugin);
new CoalGenerator(categories.electricity, SlimefunItems.COAL_GENERATOR_2, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {new ItemStack(Material.MAGMA_BLOCK), SlimefunItems.HEATING_COIL, new ItemStack(Material.MAGMA_BLOCK), SlimefunItems.HARDENED_METAL_INGOT, SlimefunItems.COAL_GENERATOR, SlimefunItems.HARDENED_METAL_INGOT, null, SlimefunItems.ELECTRIC_MOTOR, null}) {
-
- @Override
- public int getEnergyProduction() {
- return 15;
- }
-
- @Override
- public int getCapacity() {
- return 256;
- }
-
- }.register(plugin);
+ new ItemStack[] {new ItemStack(Material.MAGMA_BLOCK), SlimefunItems.HEATING_COIL, new ItemStack(Material.MAGMA_BLOCK), SlimefunItems.HARDENED_METAL_INGOT, SlimefunItems.COAL_GENERATOR, SlimefunItems.HARDENED_METAL_INGOT, null, SlimefunItems.ELECTRIC_MOTOR, null})
+ .setCapacity(256)
+ .setEnergyProduction(15)
+ .register(plugin);
new BioGenerator(categories.electricity, SlimefunItems.BIO_REACTOR, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {SlimefunItems.HEATING_COIL, SlimefunItems.COMPOSTER, SlimefunItems.HEATING_COIL, SlimefunItems.ALUMINUM_BRASS_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ALUMINUM_BRASS_INGOT, null, SlimefunItems.ALUMINUM_BRASS_INGOT, null}) {
-
- @Override
- public int getEnergyProduction() {
- return 4;
- }
-
- @Override
- public int getCapacity() {
- return 128;
- }
-
- }.register(plugin);
+ new ItemStack[] {SlimefunItems.HEATING_COIL, SlimefunItems.COMPOSTER, SlimefunItems.HEATING_COIL, SlimefunItems.ALUMINUM_BRASS_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ALUMINUM_BRASS_INGOT, null, SlimefunItems.ALUMINUM_BRASS_INGOT, null})
+ .setCapacity(128)
+ .setEnergyProduction(4)
+ .register(plugin);
new AutoDrier(categories.electricity, SlimefunItems.AUTO_DRIER, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[]{null, null, null, SlimefunItems.HEATING_COIL, new ItemStack(Material.SMOKER), SlimefunItems.HEATING_COIL, null, new ItemStack(Material.CAMPFIRE), null})
+ .setCapacity(128)
+ .setEnergyConsumption(5)
+ .setProcessingSpeed(1)
.register(plugin);
new AutoBrewer(categories.electricity, SlimefunItems.AUTO_BREWER, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {null, SlimefunItems.HEATING_COIL, null, SlimefunItems.REINFORCED_PLATE, new ItemStack(Material.BREWING_STAND), SlimefunItems.REINFORCED_PLATE, null, SlimefunItems.ELECTRIC_MOTOR, null}) {
-
- @Override
- public int getSpeed() {
- return 1;
- }
-
- }.register(plugin);
+ new ItemStack[] {null, SlimefunItems.HEATING_COIL, null, SlimefunItems.REINFORCED_PLATE, new ItemStack(Material.BREWING_STAND), SlimefunItems.REINFORCED_PLATE, null, SlimefunItems.ELECTRIC_MOTOR, null})
+ .setCapacity(128)
+ .setEnergyConsumption(6)
+ .setProcessingSpeed(1)
+ .register(plugin);
new ElectricPress(categories.electricity, SlimefunItems.ELECTRIC_PRESS, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {new ItemStack(Material.PISTON), SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.PISTON), null, SlimefunItems.MEDIUM_CAPACITOR, null, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT}) {
-
- @Override
- public int getEnergyConsumption() {
- return 8;
- }
-
- @Override
- public int getCapacity() {
- return 256;
- }
-
- @Override
- public int getSpeed() {
- return 1;
- }
-
- }.register(plugin);
+ new ItemStack[] {new ItemStack(Material.PISTON), SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.PISTON), null, SlimefunItems.MEDIUM_CAPACITOR, null, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT})
+ .setCapacity(256)
+ .setEnergyConsumption(8)
+ .setProcessingSpeed(1)
+ .register(plugin);
new ElectricPress(categories.electricity, SlimefunItems.ELECTRIC_PRESS_2, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {new ItemStack(Material.STICKY_PISTON), SlimefunItems.ELECTRIC_PRESS, new ItemStack(Material.STICKY_PISTON), SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.BIG_CAPACITOR, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT}) {
-
- @Override
- public int getEnergyConsumption() {
- return 20;
- }
-
- @Override
- public int getCapacity() {
- return 1024;
- }
-
- @Override
- public int getSpeed() {
- return 3;
- }
-
- }.register(plugin);
+ new ItemStack[] {new ItemStack(Material.STICKY_PISTON), SlimefunItems.ELECTRIC_PRESS, new ItemStack(Material.STICKY_PISTON), SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.BIG_CAPACITOR, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT})
+ .setCapacity(1024)
+ .setEnergyConsumption(20)
+ .setProcessingSpeed(3)
+ .register(plugin);
new SlimefunItem(categories.resources, SlimefunItems.MAGNESIUM_SALT, RecipeType.HEATED_PRESSURE_CHAMBER,
new ItemStack[] {SlimefunItems.MAGNESIUM_DUST, SlimefunItems.SALT, null, null, null, null, null, null, null})
.register(plugin);
new MagnesiumGenerator(categories.electricity, SlimefunItems.MAGNESIUM_GENERATOR, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {null, SlimefunItems.ELECTRIC_MOTOR, null, SlimefunItems.COMPRESSED_CARBON, new ItemStack(Material.WATER_BUCKET), SlimefunItems.COMPRESSED_CARBON, SlimefunItems.DURALUMIN_INGOT, SlimefunItems.DURALUMIN_INGOT, SlimefunItems.DURALUMIN_INGOT}) {
-
- @Override
- public int getEnergyProduction() {
- return 18;
- }
-
- @Override
- public int getCapacity() {
- return 128;
- }
-
- }.register(plugin);
+ new ItemStack[] {null, SlimefunItems.ELECTRIC_MOTOR, null, SlimefunItems.COMPRESSED_CARBON, new ItemStack(Material.WATER_BUCKET), SlimefunItems.COMPRESSED_CARBON, SlimefunItems.DURALUMIN_INGOT, SlimefunItems.DURALUMIN_INGOT, SlimefunItems.DURALUMIN_INGOT})
+ .setCapacity(128)
+ .setEnergyProduction(18)
+ .register(plugin);
new AutoEnchanter(categories.electricity, SlimefunItems.AUTO_ENCHANTER, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {null, new ItemStack(Material.ENCHANTING_TABLE), null, SlimefunItems.CARBONADO, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.CARBONADO, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.WITHER_PROOF_OBSIDIAN})
+ .setCapacity(128)
+ .setEnergyConsumption(9)
+ .setProcessingSpeed(1)
.register(plugin);
new AutoDisenchanter(categories.electricity, SlimefunItems.AUTO_DISENCHANTER, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {new ItemStack(Material.REDSTONE), new ItemStack(Material.ANVIL), new ItemStack(Material.REDSTONE), SlimefunItems.CARBONADO, SlimefunItems.AUTO_ENCHANTER, SlimefunItems.CARBONADO, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.WITHER_PROOF_OBSIDIAN})
+ .setCapacity(128)
+ .setEnergyConsumption(9)
+ .setProcessingSpeed(1)
.register(plugin);
new AutoAnvil(categories.electricity, 10, SlimefunItems.AUTO_ANVIL, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {null, new ItemStack(Material.ANVIL), null, SlimefunItems.REINFORCED_ALLOY_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.REINFORCED_ALLOY_INGOT, new ItemStack(Material.IRON_BLOCK), new ItemStack(Material.IRON_BLOCK), new ItemStack(Material.IRON_BLOCK)}) {
-
- @Override
- public int getCapacity() {
- return 128;
- }
-
- @Override
- public int getEnergyConsumption() {
- return 12;
- }
-
- }.register(plugin);
+ new ItemStack[] {null, new ItemStack(Material.ANVIL), null, SlimefunItems.REINFORCED_ALLOY_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.REINFORCED_ALLOY_INGOT, new ItemStack(Material.IRON_BLOCK), new ItemStack(Material.IRON_BLOCK), new ItemStack(Material.IRON_BLOCK)})
+ .setCapacity(128)
+ .setEnergyConsumption(12)
+ .setProcessingSpeed(1)
+ .register(plugin);
new AutoAnvil(categories.electricity, 25, SlimefunItems.AUTO_ANVIL_2, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {null, SlimefunItems.AUTO_ANVIL, null, SlimefunItems.STEEL_PLATE, SlimefunItems.HEATING_COIL, SlimefunItems.STEEL_PLATE, new ItemStack(Material.IRON_BLOCK), new ItemStack(Material.IRON_BLOCK), new ItemStack(Material.IRON_BLOCK)}) {
-
- @Override
- public int getCapacity() {
- return 256;
- }
-
- @Override
- public int getEnergyConsumption() {
- return 16;
- }
-
- }.register(plugin);
+ new ItemStack[] {null, SlimefunItems.AUTO_ANVIL, null, SlimefunItems.STEEL_PLATE, SlimefunItems.HEATING_COIL, SlimefunItems.STEEL_PLATE, new ItemStack(Material.IRON_BLOCK), new ItemStack(Material.IRON_BLOCK), new ItemStack(Material.IRON_BLOCK)})
+ .setCapacity(256)
+ .setEnergyConsumption(16)
+ .setProcessingSpeed(1)
+ .register(plugin);
new Multimeter(categories.technicalGadgets, SlimefunItems.MULTIMETER, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {SlimefunItems.COPPER_INGOT, null, SlimefunItems.COPPER_INGOT, null, SlimefunItems.REDSTONE_ALLOY, null, null, SlimefunItems.GOLD_6K, null})
@@ -2293,32 +1981,32 @@ public final class SlimefunItemSetup {
new RainbowBlock(categories.magicalGadgets, SlimefunItems.RAINBOW_WOOL, RecipeType.ANCIENT_ALTAR,
new ItemStack[] {new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.WHITE_WOOL), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.WHITE_WOOL)},
- new SlimefunItemStack(SlimefunItems.RAINBOW_WOOL, 8), new RainbowTickHandler(ColoredMaterials.WOOL))
+ new SlimefunItemStack(SlimefunItems.RAINBOW_WOOL, 8), new RainbowTickHandler(ColoredMaterial.WOOL))
.register(plugin);
new RainbowBlock(categories.magicalGadgets, SlimefunItems.RAINBOW_GLASS, RecipeType.ANCIENT_ALTAR,
new ItemStack[] {new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.WHITE_STAINED_GLASS), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.WHITE_STAINED_GLASS)},
- new SlimefunItemStack(SlimefunItems.RAINBOW_GLASS, 8), new RainbowTickHandler(ColoredMaterials.STAINED_GLASS))
+ new SlimefunItemStack(SlimefunItems.RAINBOW_GLASS, 8), new RainbowTickHandler(ColoredMaterial.STAINED_GLASS))
.register(plugin);
new RainbowBlock(categories.magicalGadgets, SlimefunItems.RAINBOW_GLASS_PANE, RecipeType.ANCIENT_ALTAR,
new ItemStack[] {new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE)},
- new SlimefunItemStack(SlimefunItems.RAINBOW_GLASS_PANE, 8), new RainbowTickHandler(ColoredMaterials.STAINED_GLASS_PANE))
+ new SlimefunItemStack(SlimefunItems.RAINBOW_GLASS_PANE, 8), new RainbowTickHandler(ColoredMaterial.STAINED_GLASS_PANE))
.register(plugin);
new RainbowBlock(categories.magicalGadgets, SlimefunItems.RAINBOW_CLAY, RecipeType.ANCIENT_ALTAR,
new ItemStack[] {new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.WHITE_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.WHITE_TERRACOTTA)},
- new SlimefunItemStack(SlimefunItems.RAINBOW_CLAY, 8), new RainbowTickHandler(ColoredMaterials.TERRACOTTA))
+ new SlimefunItemStack(SlimefunItems.RAINBOW_CLAY, 8), new RainbowTickHandler(ColoredMaterial.TERRACOTTA))
.register(plugin);
new RainbowBlock(categories.magicalGadgets, SlimefunItems.RAINBOW_CONCRETE, RecipeType.ANCIENT_ALTAR,
new ItemStack[] {new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.WHITE_CONCRETE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.WHITE_CONCRETE)},
- new SlimefunItemStack(SlimefunItems.RAINBOW_CONCRETE, 8), new RainbowTickHandler(ColoredMaterials.CONCRETE))
+ new SlimefunItemStack(SlimefunItems.RAINBOW_CONCRETE, 8), new RainbowTickHandler(ColoredMaterial.CONCRETE))
.register(plugin);
new RainbowBlock(categories.magicalGadgets, SlimefunItems.RAINBOW_GLAZED_TERRACOTTA, RecipeType.ANCIENT_ALTAR,
new ItemStack[] {new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA)},
- new SlimefunItemStack(SlimefunItems.RAINBOW_GLAZED_TERRACOTTA, 8), new RainbowTickHandler(ColoredMaterials.GLAZED_TERRACOTTA))
+ new SlimefunItemStack(SlimefunItems.RAINBOW_GLAZED_TERRACOTTA, 8), new RainbowTickHandler(ColoredMaterial.GLAZED_TERRACOTTA))
.register(plugin);
// Christmas
@@ -2431,44 +2119,18 @@ public final class SlimefunItemSetup {
.register(plugin);
new OilPump(categories.gps, SlimefunItems.OIL_PUMP, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {SlimefunItems.STEEL_INGOT, SlimefunItems.MEDIUM_CAPACITOR, SlimefunItems.STEEL_INGOT, SlimefunItems.STEEL_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.STEEL_INGOT, null, new ItemStack(Material.BUCKET), null}) {
-
- @Override
- public int getEnergyConsumption() {
- return 14;
- }
-
- @Override
- public int getCapacity() {
- return 256;
- }
-
- @Override
- public int getSpeed() {
- return 1;
- }
-
- }.register(plugin);
+ new ItemStack[] {SlimefunItems.STEEL_INGOT, SlimefunItems.MEDIUM_CAPACITOR, SlimefunItems.STEEL_INGOT, SlimefunItems.STEEL_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.STEEL_INGOT, null, new ItemStack(Material.BUCKET), null})
+ .setCapacity(256)
+ .setEnergyConsumption(14)
+ .setProcessingSpeed(1)
+ .register(plugin);
new GEOMiner(categories.gps, SlimefunItems.GEO_MINER, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {new ItemStack(Material.DIAMOND_PICKAXE), SlimefunItems.MEDIUM_CAPACITOR, new ItemStack(Material.DIAMOND_PICKAXE), SlimefunItems.REINFORCED_ALLOY_INGOT, SlimefunItems.OIL_PUMP, SlimefunItems.REINFORCED_ALLOY_INGOT, null, SlimefunItems.ELECTRIC_MOTOR, null}) {
-
- @Override
- public int getSpeed() {
- return 1;
- }
-
- @Override
- public int getCapacity() {
- return 512;
- }
-
- @Override
- public int getEnergyConsumption() {
- return 24;
- }
-
- }.register(plugin);
+ new ItemStack[] {new ItemStack(Material.DIAMOND_PICKAXE), SlimefunItems.MEDIUM_CAPACITOR, new ItemStack(Material.DIAMOND_PICKAXE), SlimefunItems.REINFORCED_ALLOY_INGOT, SlimefunItems.OIL_PUMP, SlimefunItems.REINFORCED_ALLOY_INGOT, null, SlimefunItems.ELECTRIC_MOTOR, null})
+ .setCapacity(512)
+ .setEnergyConsumption(24)
+ .setProcessingSpeed(1)
+ .register(plugin);
new SlimefunItem(categories.resources, SlimefunItems.OIL_BUCKET, new RecipeType(new NamespacedKey(plugin, "oil_pump"), SlimefunItems.OIL_PUMP),
new ItemStack[] {null, null, null, null, new ItemStack(Material.BUCKET), null, null, null, null})
@@ -2483,69 +2145,29 @@ public final class SlimefunItemSetup {
.register(plugin);
new Refinery(categories.electricity, SlimefunItems.REFINERY, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {SlimefunItems.HARDENED_GLASS, SlimefunItems.REDSTONE_ALLOY, SlimefunItems.HARDENED_GLASS, SlimefunItems.HARDENED_GLASS, SlimefunItems.REDSTONE_ALLOY, SlimefunItems.HARDENED_GLASS, new ItemStack(Material.PISTON), SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.PISTON)}) {
-
- @Override
- public int getEnergyConsumption() {
- return 16;
- }
-
- @Override
- public int getCapacity() {
- return 256;
- }
-
- @Override
- public int getSpeed() {
- return 1;
- }
-
- }.register(plugin);
+ new ItemStack[] {SlimefunItems.HARDENED_GLASS, SlimefunItems.REDSTONE_ALLOY, SlimefunItems.HARDENED_GLASS, SlimefunItems.HARDENED_GLASS, SlimefunItems.REDSTONE_ALLOY, SlimefunItems.HARDENED_GLASS, new ItemStack(Material.PISTON), SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.PISTON)})
+ .setCapacity(256)
+ .setEnergyConsumption(16)
+ .setProcessingSpeed(1)
+ .register(plugin);
new LavaGenerator(categories.electricity, SlimefunItems.LAVA_GENERATOR, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {null, SlimefunItems.GOLD_16K, null, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.HEATING_COIL, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.HEATING_COIL}) {
-
- @Override
- public int getEnergyProduction() {
- return 10;
- }
-
- @Override
- public int getCapacity() {
- return 512;
- }
-
- }.register(plugin);
+ new ItemStack[] {null, SlimefunItems.GOLD_16K, null, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.HEATING_COIL, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.HEATING_COIL})
+ .setCapacity(512)
+ .setEnergyProduction(10)
+ .register(plugin);
new LavaGenerator(categories.electricity, SlimefunItems.LAVA_GENERATOR_2, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {SlimefunItems.CORINTHIAN_BRONZE_INGOT, SlimefunItems.CORINTHIAN_BRONZE_INGOT, SlimefunItems.CORINTHIAN_BRONZE_INGOT, SlimefunItems.COMPRESSED_CARBON, SlimefunItems.LAVA_GENERATOR, SlimefunItems.COMPRESSED_CARBON, SlimefunItems.HEATING_COIL, SlimefunItems.COMPRESSED_CARBON, SlimefunItems.HEATING_COIL}) {
-
- @Override
- public int getEnergyProduction() {
- return 20;
- }
-
- @Override
- public int getCapacity() {
- return 1024;
- }
-
- }.register(plugin);
+ new ItemStack[] {SlimefunItems.CORINTHIAN_BRONZE_INGOT, SlimefunItems.CORINTHIAN_BRONZE_INGOT, SlimefunItems.CORINTHIAN_BRONZE_INGOT, SlimefunItems.COMPRESSED_CARBON, SlimefunItems.LAVA_GENERATOR, SlimefunItems.COMPRESSED_CARBON, SlimefunItems.HEATING_COIL, SlimefunItems.COMPRESSED_CARBON, SlimefunItems.HEATING_COIL})
+ .setCapacity(1024)
+ .setEnergyProduction(20)
+ .register(plugin);
new CombustionGenerator(categories.electricity, SlimefunItems.COMBUSTION_REACTOR, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {null, SlimefunItems.STEEL_INGOT, null, SlimefunItems.STEEL_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.STEEL_INGOT, SlimefunItems.HEATING_COIL, SlimefunItems.STEEL_INGOT, SlimefunItems.HEATING_COIL}) {
-
- @Override
- public int getEnergyProduction() {
- return 12;
- }
-
- @Override
- public int getCapacity() {
- return 256;
- }
-
- }.register(plugin);
+ new ItemStack[] {null, SlimefunItems.STEEL_INGOT, null, SlimefunItems.STEEL_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.STEEL_INGOT, SlimefunItems.HEATING_COIL, SlimefunItems.STEEL_INGOT, SlimefunItems.HEATING_COIL})
+ .setCapacity(256)
+ .setEnergyProduction(12)
+ .register(plugin);
new TeleporterPylon(categories.gps, SlimefunItems.GPS_TELEPORTER_PYLON, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {SlimefunItems.ZINC_INGOT, new ItemStack(Material.GLASS), SlimefunItems.ZINC_INGOT, new ItemStack(Material.GLASS), SlimefunItems.HEATING_COIL, new ItemStack(Material.GLASS), SlimefunItems.ZINC_INGOT, new ItemStack(Material.GLASS), SlimefunItems.ZINC_INGOT},
@@ -2591,44 +2213,18 @@ public final class SlimefunItemSetup {
.register(plugin);
new FoodFabricator(categories.electricity, SlimefunItems.FOOD_FABRICATOR, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {SlimefunItems.BILLON_INGOT, SlimefunItems.SILVER_INGOT, SlimefunItems.BILLON_INGOT, SlimefunItems.TIN_CAN, SlimefunItems.SMALL_CAPACITOR, SlimefunItems.TIN_CAN, null, SlimefunItems.ELECTRIC_MOTOR, null}) {
-
- @Override
- public int getEnergyConsumption() {
- return 7;
- }
-
- @Override
- public int getCapacity() {
- return 256;
- }
-
- @Override
- public int getSpeed() {
- return 1;
- }
-
- }.register(plugin);
+ new ItemStack[] {SlimefunItems.BILLON_INGOT, SlimefunItems.SILVER_INGOT, SlimefunItems.BILLON_INGOT, SlimefunItems.TIN_CAN, SlimefunItems.SMALL_CAPACITOR, SlimefunItems.TIN_CAN, null, SlimefunItems.ELECTRIC_MOTOR, null})
+ .setCapacity(256)
+ .setEnergyConsumption(7)
+ .setProcessingSpeed(1)
+ .register(plugin);
new FoodFabricator(categories.electricity, SlimefunItems.FOOD_FABRICATOR_2, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {SlimefunItems.HARDENED_METAL_INGOT, SlimefunItems.REINFORCED_ALLOY_INGOT, SlimefunItems.HARDENED_METAL_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.FOOD_FABRICATOR, SlimefunItems.ELECTRIC_MOTOR, null, SlimefunItems.ELECTRO_MAGNET, null}) {
-
- @Override
- public int getEnergyConsumption() {
- return 24;
- }
-
- @Override
- public int getCapacity() {
- return 512;
- }
-
- @Override
- public int getSpeed() {
- return 6;
- }
-
- }.register(plugin);
+ new ItemStack[] {SlimefunItems.HARDENED_METAL_INGOT, SlimefunItems.REINFORCED_ALLOY_INGOT, SlimefunItems.HARDENED_METAL_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.FOOD_FABRICATOR, SlimefunItems.ELECTRIC_MOTOR, null, SlimefunItems.ELECTRO_MAGNET, null})
+ .setCapacity(512)
+ .setEnergyConsumption(24)
+ .setProcessingSpeed(6)
+ .register(plugin);
new OrganicFood(categories.misc, SlimefunItems.WHEAT_ORGANIC_FOOD, Material.WHEAT)
.register(plugin);
@@ -2677,44 +2273,18 @@ public final class SlimefunItemSetup {
.register(plugin);
new FoodComposter(categories.electricity, SlimefunItems.FOOD_COMPOSTER, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.FOOD_FABRICATOR, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.TIN_CAN, SlimefunItems.MEDIUM_CAPACITOR, SlimefunItems.TIN_CAN, null, SlimefunItems.ELECTRIC_MOTOR, null}) {
-
- @Override
- public int getEnergyConsumption() {
- return 8;
- }
-
- @Override
- public int getCapacity() {
- return 256;
- }
-
- @Override
- public int getSpeed() {
- return 1;
- }
-
- }.register(plugin);
+ new ItemStack[] {SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.FOOD_FABRICATOR, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.TIN_CAN, SlimefunItems.MEDIUM_CAPACITOR, SlimefunItems.TIN_CAN, null, SlimefunItems.ELECTRIC_MOTOR, null})
+ .setCapacity(256)
+ .setEnergyConsumption(8)
+ .setProcessingSpeed(1)
+ .register(plugin);
new FoodComposter(categories.electricity, SlimefunItems.FOOD_COMPOSTER_2, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {SlimefunItems.HARDENED_METAL_INGOT, SlimefunItems.REINFORCED_ALLOY_INGOT, SlimefunItems.HARDENED_METAL_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.FOOD_COMPOSTER, SlimefunItems.ELECTRIC_MOTOR, null, SlimefunItems.ELECTRO_MAGNET, null}) {
-
- @Override
- public int getEnergyConsumption() {
- return 26;
- }
-
- @Override
- public int getCapacity() {
- return 512;
- }
-
- @Override
- public int getSpeed() {
- return 10;
- }
-
- }.register(plugin);
+ new ItemStack[] {SlimefunItems.HARDENED_METAL_INGOT, SlimefunItems.REINFORCED_ALLOY_INGOT, SlimefunItems.HARDENED_METAL_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.FOOD_COMPOSTER, SlimefunItems.ELECTRIC_MOTOR, null, SlimefunItems.ELECTRO_MAGNET, null})
+ .setCapacity(512)
+ .setEnergyConsumption(26)
+ .setProcessingSpeed(10)
+ .register(plugin);
new OrganicFertilizer(categories.misc, SlimefunItems.WHEAT_FERTILIZER, SlimefunItems.WHEAT_ORGANIC_FOOD)
.register(plugin);
@@ -2787,34 +2357,18 @@ public final class SlimefunItemSetup {
}.register(plugin);
new Freezer(categories.electricity, SlimefunItems.FREEZER, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {null, SlimefunItems.SILVER_INGOT, null, SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.PACKED_ICE), SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.COOLING_UNIT, SlimefunItems.MEDIUM_CAPACITOR, SlimefunItems.COOLING_UNIT}) {
-
- @Override
- public int getEnergyConsumption() {
- return 9;
- }
-
- @Override
- public int getSpeed() {
- return 1;
- }
-
- }.register(plugin);
+ new ItemStack[] {null, SlimefunItems.SILVER_INGOT, null, SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.PACKED_ICE), SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.COOLING_UNIT, SlimefunItems.MEDIUM_CAPACITOR, SlimefunItems.COOLING_UNIT})
+ .setCapacity(256)
+ .setEnergyConsumption(9)
+ .setProcessingSpeed(1)
+ .register(plugin);
new Freezer(categories.electricity, SlimefunItems.FREEZER_2, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {null, SlimefunItems.SILVER_INGOT, null, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.FREEZER, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.COOLING_UNIT, SlimefunItems.ALUMINUM_BRASS_INGOT, SlimefunItems.COOLING_UNIT}) {
-
- @Override
- public int getEnergyConsumption() {
- return 15;
- }
-
- @Override
- public int getSpeed() {
- return 2;
- }
-
- }.register(plugin);
+ new ItemStack[] {null, SlimefunItems.SILVER_INGOT, null, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.FREEZER, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.COOLING_UNIT, SlimefunItems.ALUMINUM_BRASS_INGOT, SlimefunItems.COOLING_UNIT})
+ .setCapacity(256)
+ .setEnergyConsumption(15)
+ .setProcessingSpeed(2)
+ .register(plugin);
new CoolantCell(categories.technicalComponents, SlimefunItems.REACTOR_COOLANT_CELL, RecipeType.FREEZER,
new ItemStack[] {new ItemStack(Material.BLUE_ICE), null, null, null, null, null, null, null, null})
@@ -2867,7 +2421,7 @@ public final class SlimefunItemSetup {
}.register(plugin);
- new SlimefunItem(categories.cargo, SlimefunItems.CARGO_MOTOR, RecipeType.ENHANCED_CRAFTING_TABLE,
+ new UnplaceableBlock(categories.cargo, SlimefunItems.CARGO_MOTOR, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {SlimefunItems.HARDENED_GLASS, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.HARDENED_GLASS, SlimefunItems.SILVER_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.SILVER_INGOT, SlimefunItems.HARDENED_GLASS, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.HARDENED_GLASS},
new SlimefunItemStack(SlimefunItems.CARGO_MOTOR, 4))
.register(plugin);
@@ -2923,104 +2477,39 @@ public final class SlimefunItemSetup {
.register(plugin);
new CarbonPress(categories.electricity, SlimefunItems.CARBON_PRESS, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {SlimefunItems.CARBON, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.CARBON, SlimefunItems.CARBON, SlimefunItems.HEATED_PRESSURE_CHAMBER, SlimefunItems.CARBON, SlimefunItems.HEATING_COIL, SlimefunItems.CARBONADO, SlimefunItems.HEATING_COIL}) {
-
- @Override
- public int getEnergyConsumption() {
- return 10;
- }
-
- @Override
- public int getCapacity() {
- return 256;
- }
-
- @Override
- public int getSpeed() {
- return 1;
- }
-
- }.register(plugin);
+ new ItemStack[] {SlimefunItems.CARBON, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.CARBON, SlimefunItems.CARBON, SlimefunItems.HEATED_PRESSURE_CHAMBER, SlimefunItems.CARBON, SlimefunItems.HEATING_COIL, SlimefunItems.CARBONADO, SlimefunItems.HEATING_COIL})
+ .setCapacity(256)
+ .setEnergyConsumption(10)
+ .setProcessingSpeed(1)
+ .register(plugin);
new CarbonPress(categories.electricity, SlimefunItems.CARBON_PRESS_2, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {SlimefunItems.CARBONADO, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.CARBONADO, SlimefunItems.CARBON, SlimefunItems.CARBON_PRESS, SlimefunItems.CARBON, SlimefunItems.HEATING_COIL, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.HEATING_COIL}) {
-
- @Override
- public int getEnergyConsumption() {
- return 25;
- }
-
- @Override
- public int getCapacity() {
- return 512;
- }
-
- @Override
- public int getSpeed() {
- return 3;
- }
-
- }.register(plugin);
+ new ItemStack[] {SlimefunItems.CARBONADO, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.CARBONADO, SlimefunItems.CARBON, SlimefunItems.CARBON_PRESS, SlimefunItems.CARBON, SlimefunItems.HEATING_COIL, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.HEATING_COIL})
+ .setCapacity(512)
+ .setEnergyConsumption(25)
+ .setProcessingSpeed(3)
+ .register(plugin);
new CarbonPress(categories.electricity, SlimefunItems.CARBON_PRESS_3, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {SlimefunItems.CARBONADO, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.CARBONADO, SlimefunItems.REINFORCED_ALLOY_INGOT, SlimefunItems.CARBON_PRESS_2, SlimefunItems.REINFORCED_ALLOY_INGOT, SlimefunItems.HEATING_COIL, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.HEATING_COIL}) {
-
- @Override
- public int getEnergyConsumption() {
- return 90;
- }
-
- @Override
- public int getCapacity() {
- return 512;
- }
-
- @Override
- public int getSpeed() {
- return 15;
- }
-
- }.register(plugin);
+ new ItemStack[] {SlimefunItems.CARBONADO, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.CARBONADO, SlimefunItems.REINFORCED_ALLOY_INGOT, SlimefunItems.CARBON_PRESS_2, SlimefunItems.REINFORCED_ALLOY_INGOT, SlimefunItems.HEATING_COIL, SlimefunItems.ELECTRO_MAGNET, SlimefunItems.HEATING_COIL})
+ .setCapacity(512)
+ .setEnergyConsumption(90)
+ .setProcessingSpeed(15)
+ .register(plugin);
new ElectricSmeltery(categories.electricity, SlimefunItems.ELECTRIC_SMELTERY, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {new ItemStack(Material.NETHER_BRICKS), SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.NETHER_BRICKS), SlimefunItems.HEATING_COIL, SlimefunItems.ELECTRIC_INGOT_FACTORY, SlimefunItems.HEATING_COIL, SlimefunItems.GILDED_IRON, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.GILDED_IRON}) {
-
- @Override
- public int getEnergyConsumption() {
- return 10;
- }
-
- @Override
- public int getCapacity() {
- return 512;
- }
-
- @Override
- public int getSpeed() {
- return 1;
- }
-
- }.register(plugin);
+ new ItemStack[] {new ItemStack(Material.NETHER_BRICKS), SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.NETHER_BRICKS), SlimefunItems.HEATING_COIL, SlimefunItems.ELECTRIC_INGOT_FACTORY, SlimefunItems.HEATING_COIL, SlimefunItems.GILDED_IRON, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.GILDED_IRON})
+ .setCapacity(512)
+ .setEnergyConsumption(10)
+ .setProcessingSpeed(1)
+ .register(plugin);
new ElectricSmeltery(categories.electricity, SlimefunItems.ELECTRIC_SMELTERY_2, RecipeType.ENHANCED_CRAFTING_TABLE,
- new ItemStack[] {SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.POWER_CRYSTAL, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.HEATING_COIL, SlimefunItems.ELECTRIC_SMELTERY, SlimefunItems.HEATING_COIL, SlimefunItems.GILDED_IRON, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.GILDED_IRON}) {
-
- @Override
- public int getEnergyConsumption() {
- return 20;
- }
-
- @Override
- public int getCapacity() {
- return 1024;
- }
-
- @Override
- public int getSpeed() {
- return 3;
- }
-
- }.register(plugin);
+ new ItemStack[] {SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.POWER_CRYSTAL, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.HEATING_COIL, SlimefunItems.ELECTRIC_SMELTERY, SlimefunItems.HEATING_COIL, SlimefunItems.GILDED_IRON, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.GILDED_IRON})
+ .setCapacity(1024)
+ .setEnergyConsumption(20)
+ .setProcessingSpeed(3)
+ .register(plugin);
new IronGolemAssembler(categories.electricity, SlimefunItems.IRON_GOLEM_ASSEMBLER, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.ADVANCED_CIRCUIT_BOARD, SlimefunItems.BLISTERING_INGOT_3, new ItemStack(Material.IRON_BLOCK), SlimefunItems.ANDROID_MEMORY_CORE, new ItemStack(Material.IRON_BLOCK), SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.REINFORCED_ALLOY_INGOT, SlimefunItems.CARBONADO_EDGED_CAPACITOR})
@@ -3067,6 +2556,8 @@ public final class SlimefunItemSetup {
new ElytraCap(categories.magicalArmor, SlimefunItems.ELYTRA_CAP, RecipeType.ARMOR_FORGE,
new ItemStack[]{new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), SlimefunItems.ELYTRA_SCALE, SlimefunItems.ELYTRA_SCALE, SlimefunItems.ELYTRA_SCALE, new ItemStack(Material.SLIME_BALL), new ItemStack(Material.LEATHER_HELMET), new ItemStack(Material.SLIME_BALL)})
.register(plugin);
+
+ // @formatter:on
}
private static void registerArmorSet(Category category, ItemStack baseComponent, ItemStack[] items, String idSyntax, boolean vanilla, PotionEffect[][] effects, SlimefunAddon addon) {
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 7f566db35..0cb2ea26f 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ChestMenuUtils.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ChestMenuUtils.java
@@ -29,6 +29,9 @@ public final class ChestMenuUtils {
private static final ItemStack INPUT_SLOT = new SlimefunItemStack("_UI_INPUT_SLOT", Material.CYAN_STAINED_GLASS_PANE, " ");
private static final ItemStack OUTPUT_SLOT = new SlimefunItemStack("_UI_OUTPUT_SLOT", Material.ORANGE_STAINED_GLASS_PANE, " ");
+ private static final ItemStack NO_PERMISSION = new SlimefunItemStack("_UI_NO_PERMISSION", Material.BARRIER, "No Permission");
+ private static final ItemStack NOT_RESEARCHED = new SlimefunItemStack("_UI_NOT_RESEARCHED", Material.BARRIER, "Not researched");
+
private static final ItemStack BACK_BUTTON = new SlimefunItemStack("_UI_BACK", Material.ENCHANTED_BOOK, "&7\u21E6 Back", meta -> meta.addItemFlags(ItemFlag.HIDE_ENCHANTS));
private static final ItemStack MENU_BUTTON = new SlimefunItemStack("_UI_MENU", Material.COMPARATOR, "&eSettings / Info", "", "&7\u21E8 Click to see more");
private static final ItemStack SEARCH_BUTTON = new SlimefunItemStack("_UI_SEARCH", Material.NAME_TAG, "&bSearch");
@@ -46,6 +49,16 @@ public final class ChestMenuUtils {
return UI_BACKGROUND;
}
+ @Nonnull
+ public static ItemStack getNoPermissionItem() {
+ return NO_PERMISSION;
+ }
+
+ @Nonnull
+ public static ItemStack getNotResearchedItem() {
+ return NOT_RESEARCHED;
+ }
+
@Nonnull
public static ItemStack getInputSlotTexture() {
return INPUT_SLOT;
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ColoredMaterials.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ColoredMaterial.java
similarity index 76%
rename from src/main/java/io/github/thebusybiscuit/slimefun4/utils/ColoredMaterials.java
rename to src/main/java/io/github/thebusybiscuit/slimefun4/utils/ColoredMaterial.java
index 274f0ed09..bb7836767 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ColoredMaterials.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ColoredMaterial.java
@@ -4,6 +4,10 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import javax.annotation.Nonnull;
+
+import org.apache.commons.lang.Validate;
+import org.bukkit.DyeColor;
import org.bukkit.Material;
import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag;
@@ -17,18 +21,14 @@ import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag;
* @see SlimefunTag
*
*/
-public final class ColoredMaterials {
+public enum ColoredMaterial {
- /**
- * We don't want any instances of this class, so we set the
- * constructor to be private.
- */
- private ColoredMaterials() {}
+ // @formatter:off (We want this to stay formatted like this)
/**
* This {@link List} contains all wool colors ordered by their appearance ingame.
*/
- public static final List WOOL = Collections.unmodifiableList(Arrays.asList(
+ WOOL(new Material[] {
Material.WHITE_WOOL,
Material.ORANGE_WOOL,
Material.MAGENTA_WOOL,
@@ -45,12 +45,12 @@ public final class ColoredMaterials {
Material.GREEN_WOOL,
Material.RED_WOOL,
Material.BLACK_WOOL
- ));
+ }),
/**
* This {@link List} contains all stained glass colors ordered by their appearance ingame.
*/
- public static final List STAINED_GLASS = Collections.unmodifiableList(Arrays.asList(
+ STAINED_GLASS(new Material[] {
Material.WHITE_STAINED_GLASS,
Material.ORANGE_STAINED_GLASS,
Material.MAGENTA_STAINED_GLASS,
@@ -67,12 +67,12 @@ public final class ColoredMaterials {
Material.GREEN_STAINED_GLASS,
Material.RED_STAINED_GLASS,
Material.BLACK_STAINED_GLASS
- ));
+ }),
/**
* This {@link List} contains all stained glass pane colors ordered by their appearance ingame.
*/
- public static final List STAINED_GLASS_PANE = Collections.unmodifiableList(Arrays.asList(
+ STAINED_GLASS_PANE(new Material[] {
Material.WHITE_STAINED_GLASS_PANE,
Material.ORANGE_STAINED_GLASS_PANE,
Material.MAGENTA_STAINED_GLASS_PANE,
@@ -89,12 +89,12 @@ public final class ColoredMaterials {
Material.GREEN_STAINED_GLASS_PANE,
Material.RED_STAINED_GLASS_PANE,
Material.BLACK_STAINED_GLASS_PANE
- ));
+ }),
/**
* This {@link List} contains all terracotta colors ordered by their appearance ingame.
*/
- public static final List TERRACOTTA = Collections.unmodifiableList(Arrays.asList(
+ TERRACOTTA(new Material[] {
Material.WHITE_TERRACOTTA,
Material.ORANGE_TERRACOTTA,
Material.MAGENTA_TERRACOTTA,
@@ -111,12 +111,12 @@ public final class ColoredMaterials {
Material.GREEN_TERRACOTTA,
Material.RED_TERRACOTTA,
Material.BLACK_TERRACOTTA
- ));
+ }),
/**
* This {@link List} contains all glazed terracotta colors ordered by their appearance ingame.
*/
- public static final List GLAZED_TERRACOTTA = Collections.unmodifiableList(Arrays.asList(
+ GLAZED_TERRACOTTA(new Material[] {
Material.WHITE_GLAZED_TERRACOTTA,
Material.ORANGE_GLAZED_TERRACOTTA,
Material.MAGENTA_GLAZED_TERRACOTTA,
@@ -133,12 +133,12 @@ public final class ColoredMaterials {
Material.GREEN_GLAZED_TERRACOTTA,
Material.RED_GLAZED_TERRACOTTA,
Material.BLACK_GLAZED_TERRACOTTA
- ));
+ }),
/**
* This {@link List} contains all concrete colors ordered by their appearance ingame.
*/
- public static final List CONCRETE = Collections.unmodifiableList(Arrays.asList(
+ CONCRETE(new Material[] {
Material.WHITE_CONCRETE,
Material.ORANGE_CONCRETE,
Material.MAGENTA_CONCRETE,
@@ -155,6 +155,42 @@ public final class ColoredMaterials {
Material.GREEN_CONCRETE,
Material.RED_CONCRETE,
Material.BLACK_CONCRETE
- ));
+ });
+
+ // @formatter:on
+
+ private final List list;
+
+ /**
+ * This creates a new constant of {@link ColoredMaterial}.
+ * The array must have a length of 16 and cannot contain null elements!
+ *
+ * @param materials
+ * The {@link Material Materials} for this {@link ColoredMaterial}.
+ */
+ ColoredMaterial(@Nonnull Material[] materials) {
+ Validate.noNullElements(materials, "The List cannot contain any null elements");
+ Validate.isTrue(materials.length == 16, "Expected 16, received: " + materials.length + ". Did you miss a color?");
+
+ list = Collections.unmodifiableList(Arrays.asList(materials));
+ }
+
+ @Nonnull
+ public List asList() {
+ return list;
+ }
+
+ @Nonnull
+ public Material get(int index) {
+ Validate.isTrue(index >= 0 && index < 16, "The index must be between 0 and 15 (inclusive).");
+
+ return list.get(index);
+ }
+
+ public Material get(@Nonnull DyeColor color) {
+ Validate.notNull(color, "Color cannot be null!");
+
+ return get(color.ordinal());
+ }
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/HeadTexture.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/HeadTexture.java
index ea095a5d7..ee8a849d0 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/HeadTexture.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/HeadTexture.java
@@ -108,7 +108,8 @@ public enum HeadTexture {
CARGO_ARROW_RIGHT("c2f910c47da042e4aa28af6cc81cf48ac6caf37dab35f88db993accb9dfe516"),
ADD_NEW_LANGUAGE("3edd20be93520949e6ce789dc4f43efaeb28c717ee6bfcbbe02780142f716"),
IRON_GOLEM("89091d79ea0f59ef7ef94d7bba6e5f17f2f7d4572c44f90f76c4819a714"),
- PIGLIN_HEAD("2882af1294a74023e6919a31d1a027310f2e142afb4667d230d155e7f21dbb41");
+ PIGLIN_HEAD("2882af1294a74023e6919a31d1a027310f2e142afb4667d230d155e7f21dbb41"),
+ NECROTIC_SKULL("7953b6c68448e7e6b6bf8fb273d7203acd8e1be19e81481ead51f45de59a8");
public static final HeadTexture[] valuesCache = values();
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/NumberUtils.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/NumberUtils.java
index a84293946..d752b5ec8 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/NumberUtils.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/NumberUtils.java
@@ -1,6 +1,7 @@
package io.github.thebusybiscuit.slimefun4.utils;
import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;
import java.time.Duration;
import java.time.LocalDateTime;
@@ -12,16 +13,51 @@ import javax.annotation.Nullable;
import org.apache.commons.lang.Validate;
import org.bukkit.ChatColor;
+/**
+ * This class contains various utilities related to numbers and number formatting.
+ *
+ * @author TheBusyBiscuit
+ * @author Walshy
+ *
+ */
public final class NumberUtils {
- private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#.##");
+ /**
+ * This is our {@link DecimalFormat} for decimal values.
+ */
+ private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#.##", DecimalFormatSymbols.getInstance(Locale.ROOT));
+ /**
+ * We do not want any instance of this to be created.
+ */
private NumberUtils() {}
- public static String formatBigNumber(int i) {
- return NumberFormat.getNumberInstance(Locale.US).format(i);
+ /**
+ * This method formats a given {@link Integer} to be displayed nicely with
+ * decimal digit grouping.
+ * {@code 1000000} for example will return {@code "1,000,000"} as a {@link String}.
+ * It uses the american (US) {@link Locale} for this transformation.
+ *
+ * @param number
+ * Your {@link Integer}
+ *
+ * @return The formatted String
+ */
+ @Nonnull
+ public static String formatBigNumber(int number) {
+ return NumberFormat.getNumberInstance(Locale.US).format(number);
}
+ /**
+ * This method transforms a String representation of a {@link LocalDateTime}
+ * from GitHub's API back into a {@link LocalDateTime} object
+ *
+ * @param date
+ * The formatted String version of a date from GitHub
+ *
+ * @return The {@link LocalDateTime} for the given input
+ */
+ @Nonnull
public static LocalDateTime parseGitHubDate(@Nonnull String date) {
Validate.notNull(date, "Provided date was null");
return LocalDateTime.parse(date.substring(0, date.length() - 1));
@@ -37,6 +73,7 @@ public final class NumberUtils {
*
* @return A representative {@link ChatColor}
*/
+ @Nonnull
public static ChatColor getColorFromPercentage(float percentage) {
if (percentage < 16.0F) {
return ChatColor.DARK_RED;
@@ -53,13 +90,51 @@ public final class NumberUtils {
}
}
+ /**
+ * This returns the elapsed time since the given {@link LocalDateTime}.
+ * The output will be nicely formatted based on the elapsed hours or days since the
+ * given {@link LocalDateTime}.
+ *
+ * If a {@link LocalDateTime} from yesterday was passed it will return {@code "1d"}.
+ * One hour later it will read {@code "1d 1h"}. For values smaller than an hour {@code "< 1h"}
+ * will be returned instead.
+ *
+ * @param date
+ * The {@link LocalDateTime}.
+ *
+ * @return The elapsed time as a {@link String}
+ */
+ @Nonnull
public static String getElapsedTime(@Nonnull LocalDateTime date) {
- Validate.notNull(date, "Provided date was null");
- long hours = Duration.between(date, LocalDateTime.now()).toHours();
+ return getElapsedTime(LocalDateTime.now(), date);
+ }
+
+ /**
+ * This returns the elapsed time between the two given {@link LocalDateTime LocalDateTimes}.
+ * The output will be nicely formatted based on the elapsed hours or days between the
+ * given {@link LocalDateTime LocalDateTime}.
+ *
+ * If a {@link LocalDateTime} from today and yesterday (exactly 24h apart) was passed it
+ * will return {@code "1d"}.
+ * One hour later it will read {@code "1d 1h"}. For values smaller than an hour {@code "< 1h"}
+ * will be returned instead.
+ *
+ * @param start
+ * The starting {@link LocalDateTime}.
+ * @param end
+ * The ending {@link LocalDateTime}.
+ *
+ * @return The elapsed time as a {@link String}
+ */
+ @Nonnull
+ public static String getElapsedTime(@Nonnull LocalDateTime start, @Nonnull LocalDateTime end) {
+ Validate.notNull(start, "Provided start was null");
+ Validate.notNull(end, "Provided end was null");
+ long hours = Duration.between(start, end).toHours();
if (hours == 0) {
return "< 1h";
- } else if ((hours / 24) == 0) {
+ } else if (hours / 24 == 0) {
return (hours % 24) + "h";
} else if (hours % 24 == 0) {
return (hours / 24) + "d";
@@ -68,10 +143,12 @@ public final class NumberUtils {
}
}
+ @Nonnull
public static String getTimeLeft(int seconds) {
String timeleft = "";
int minutes = (int) (seconds / 60L);
+
if (minutes > 0) {
timeleft += minutes + "m ";
}
@@ -80,14 +157,27 @@ public final class NumberUtils {
return timeleft + seconds + "s";
}
- public static int getInt(String str, int defaultValue) {
+ /**
+ * This method parses a {@link String} into an {@link Integer}.
+ * If the {@link String} could not be parsed correctly, the provided
+ * default value will be returned instead.
+ *
+ * @param str
+ * The {@link String} to parse
+ * @param defaultValue
+ * The default value for when the {@link String} could not be parsed
+ *
+ * @return The resulting {@link Integer}
+ */
+ public static int getInt(@Nonnull String str, int defaultValue) {
if (PatternUtils.NUMERIC.matcher(str).matches()) {
return Integer.parseInt(str);
+ } else {
+ return defaultValue;
}
-
- return defaultValue;
}
+ @Nonnull
public static String getAsMillis(long nanoseconds) {
if (nanoseconds == 0) {
return "0ms";
@@ -129,6 +219,8 @@ public final class NumberUtils {
* The value to clamp
* @param max
* The maximum value
+ *
+ * @return The clamped value
*/
public static int clamp(int min, int value, int max) {
if (value < min) {
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/tags/SlimefunTag.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/tags/SlimefunTag.java
index 74dc60adf..289314298 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/tags/SlimefunTag.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/tags/SlimefunTag.java
@@ -35,9 +35,9 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.tools.SmeltersPic
* extensions of the default Minecraft tags.
* The actual tag files are located in the {@literal /src/main/resources/tags} directory
* and follow Minecraft's tags.json format.
- *
+ *
* @author TheBusyBiscuit
- *
+ *
* @see TagParser
*
*/
@@ -121,6 +121,16 @@ public enum SlimefunTag implements Tag {
*/
CONCRETE_POWDERS,
+ /**
+ * All the types of pressure plates.
+ */
+ PRESSURE_PLATES,
+
+ /**
+ * All tall flowers because minecraft doesn't have a tag for this
+ */
+ TALL_FLOWERS,
+
/**
* Materials which are sensitive to break.
* Things like Saplings or Pressure plates which break as well when you break
@@ -219,7 +229,7 @@ public enum SlimefunTag implements Tag {
/**
* This method reloads this {@link SlimefunTag} from our resources directory.
- *
+ *
* @throws TagMisconfigurationException
* This is thrown whenever a {@link SlimefunTag} could not be parsed properly
*/
@@ -236,11 +246,11 @@ public enum SlimefunTag implements Tag {
/**
* This method reloads every single {@link SlimefunTag} from the resources directory.
* It is equivalent to running {@link #reload()} on every single {@link SlimefunTag} manually.
- *
+ *
* Do keep in mind though that any misconfigured {@link SlimefunTag} will abort the entire
* method and throw a {@link TagMisconfigurationException}. So one faulty {@link SlimefunTag}
* will stop the reloading process.
- *
+ *
* @throws TagMisconfigurationException
* This is thrown if one of the {@link SlimefunTag SlimefunTags} could not be parsed correctly
*/
@@ -293,9 +303,9 @@ public enum SlimefunTag implements Tag {
/**
* This returns a {@link Set} of {@link Tag Tags} which are children of this {@link SlimefunTag},
* these can be other {@link SlimefunTag SlimefunTags} or regular {@link Tag Tags}.
- *
+ *
* The returned {@link Set} is immutable
- *
+ *
* @return An immutable {@link Set} of all sub tags.
*/
@Nonnull
@@ -305,7 +315,7 @@ public enum SlimefunTag implements Tag {
/**
* This method returns an Array representation for this {@link SlimefunTag}.
- *
+ *
* @return A {@link Material} array for this {@link Tag}
*/
@Nonnull
@@ -315,7 +325,7 @@ public enum SlimefunTag implements Tag {
/**
* This returns a {@link Stream} of {@link Material Materials} for this {@link SlimefunTag}.
- *
+ *
* @return A {@link Stream} of {@link Material Materials}
*/
@Nonnull
@@ -331,7 +341,7 @@ public enum SlimefunTag implements Tag {
*
* @param value
* The value which you would like to look up.
- *
+ *
* @return The {@link SlimefunTag} or null if it does not exist.
*/
@Nullable
diff --git a/src/main/java/me/mrCookieSlime/Slimefun/Objects/Category.java b/src/main/java/me/mrCookieSlime/Slimefun/Objects/Category.java
index c69a682ec..8c788e94f 100644
--- a/src/main/java/me/mrCookieSlime/Slimefun/Objects/Category.java
+++ b/src/main/java/me/mrCookieSlime/Slimefun/Objects/Category.java
@@ -134,6 +134,7 @@ public class Category implements Keyed {
*
* @param p
* The Player to create this {@link ItemStack} for
+ *
* @return A localized display item for this {@link Category}
*/
@Nonnull
@@ -166,6 +167,26 @@ public class Category implements Keyed {
return ChatColor.stripColor(item.getItemMeta().getDisplayName());
}
+ /**
+ * This returns the localized display name of this {@link Category} for the given {@link Player}.
+ * The method will fall back to {@link #getUnlocalizedName()} if no translation was found.
+ *
+ * @param p
+ * The {@link Player} who to translate the name for
+ *
+ * @return The localized name of this {@link Category}
+ */
+ @Nonnull
+ public String getDisplayName(@Nonnull Player p) {
+ String localized = SlimefunPlugin.getLocalization().getCategoryName(p, getKey());
+
+ if (localized != null) {
+ return localized;
+ } else {
+ return getUnlocalizedName();
+ }
+ }
+
/**
* Returns all instances of {@link SlimefunItem} bound to this {@link Category}.
*
diff --git a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java
index 335b3fccc..8facdbc35 100644
--- a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java
+++ b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java
@@ -84,7 +84,7 @@ public class SlimefunItem implements Placeable {
* This is a reference to the {@link SlimefunAddon} that registered this
* {@link SlimefunItem}, if the item has not been registered yet, it will be null.
*/
- private SlimefunAddon addon;
+ protected SlimefunAddon addon;
/**
* This is the state of this {@link SlimefunItem}.
@@ -930,6 +930,8 @@ public class SlimefunItem implements Placeable {
* The message to send
*/
public void info(@Nonnull String message) {
+ Validate.notNull(addon, "Cannot log a message for an unregistered item!");
+
String msg = toString() + ": " + message;
addon.getLogger().log(Level.INFO, msg);
}
@@ -943,6 +945,8 @@ public class SlimefunItem implements Placeable {
* The message to send
*/
public void warn(@Nonnull String message) {
+ Validate.notNull(addon, "Cannot send a warning for an unregistered item!");
+
String msg = toString() + ": " + message;
addon.getLogger().log(Level.WARNING, msg);
@@ -962,6 +966,8 @@ public class SlimefunItem implements Placeable {
* The {@link Throwable} to throw as a stacktrace.
*/
public void error(@Nonnull String message, @Nonnull Throwable throwable) {
+ Validate.notNull(addon, "Cannot send an error for an unregistered item!");
+
addon.getLogger().log(Level.SEVERE, "Item \"{0}\" from {1} v{2} has caused an Error!", new Object[] { id, addon.getName(), addon.getPluginVersion() });
if (addon.getBugTrackerURL() != null) {
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 daf180de3..964db45ec 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
@@ -5,9 +5,12 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
+import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
+import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
@@ -17,7 +20,9 @@ import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.inventory.InvUtils;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
+import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
import io.github.thebusybiscuit.slimefun4.api.events.AsyncMachineProcessCompleteEvent;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemState;
import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent;
import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
@@ -47,6 +52,10 @@ public abstract class AContainer extends SlimefunItem implements InventoryBlock,
protected final List recipes = new ArrayList<>();
+ private int energyConsumedPerTick = -1;
+ private int energyCapacity = -1;
+ private int processingSpeed = -1;
+
@ParametersAreNonnullByDefault
public AContainer(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
@@ -114,6 +123,7 @@ public abstract class AContainer extends SlimefunItem implements InventoryBlock,
*
* @return The title of the {@link Inventory} of this {@link AContainer}
*/
+ @Nonnull
public String getInventoryTitle() {
return getItemName();
}
@@ -128,12 +138,23 @@ public abstract class AContainer extends SlimefunItem implements InventoryBlock,
*/
public abstract ItemStack getProgressBar();
+ /**
+ * This method returns the max amount of electricity this machine can hold.
+ *
+ * @return The max amount of electricity this Block can store.
+ */
+ public int getCapacity() {
+ return energyCapacity;
+ }
+
/**
* This method returns the amount of energy that is consumed per operation.
*
* @return The rate of energy consumption
*/
- public abstract int getEnergyConsumption();
+ public int getEnergyConsumption() {
+ return energyConsumedPerTick;
+ }
/**
* This method returns the speed at which this machine will operate.
@@ -142,7 +163,86 @@ public abstract class AContainer extends SlimefunItem implements InventoryBlock,
*
* @return The speed of this machine
*/
- public abstract int getSpeed();
+ public int getSpeed() {
+ return processingSpeed;
+ }
+
+ /**
+ * This sets the energy capacity for this machine.
+ * This method must be called before registering the item
+ * and only before registering.
+ *
+ * @param capacity
+ * The amount of energy this machine can store
+ *
+ * @return This method will return the current instance of {@link AContainer}, so that can be chained.
+ */
+ public final AContainer setCapacity(int capacity) {
+ Validate.isTrue(capacity > 0, "The capacity must be greater than zero!");
+
+ if (getState() == ItemState.UNREGISTERED) {
+ this.energyCapacity = capacity;
+ return this;
+ } else {
+ throw new IllegalStateException("You cannot modify the capacity after the Item was registered.");
+ }
+ }
+
+ /**
+ * This sets the speed of this machine.
+ *
+ * @param speed
+ * The speed multiplier for this machine, must be above zero
+ *
+ * @return This method will return the current instance of {@link AContainer}, so that can be chained.
+ */
+ public final AContainer setProcessingSpeed(int speed) {
+ Validate.isTrue(speed > 0, "The speed must be greater than zero!");
+
+ this.processingSpeed = speed;
+ return this;
+ }
+
+ /**
+ * This method sets the energy consumed by this machine per tick.
+ *
+ * @param energyConsumption
+ * The energy consumed per tick
+ *
+ * @return This method will return the current instance of {@link AContainer}, so that can be chained.
+ */
+ public final AContainer setEnergyConsumption(int energyConsumption) {
+ Validate.isTrue(energyConsumption > 0, "The energy consumption must be greater than zero!");
+ Validate.isTrue(energyCapacity > 0, "You must specify the capacity before you can set the consumption amount.");
+ Validate.isTrue(energyConsumption <= energyCapacity, "The energy consumption cannot be higher than the capacity (" + energyCapacity + ')');
+
+ this.energyConsumedPerTick = energyConsumption;
+ return this;
+ }
+
+ @Override
+ public void register(@Nonnull SlimefunAddon addon) {
+ this.addon = addon;
+
+ if (getCapacity() <= 0) {
+ warn("The capacity has not been configured correctly. The Item was disabled.");
+ warn("Make sure to call '" + getClass().getSimpleName() + "#setEnergyCapacity(...)' before registering!");
+ }
+
+ if (getEnergyConsumption() <= 0) {
+ warn("The energy consumption has not been configured correctly. The Item was disabled.");
+ warn("Make sure to call '" + getClass().getSimpleName() + "#setEnergyConsumption(...)' before registering!");
+ }
+
+ if (getSpeed() <= 0) {
+ warn("The processing speed has not been configured correctly. The Item was disabled.");
+ warn("Make sure to call '" + getClass().getSimpleName() + "#setProcessingSpeed(...)' before registering!");
+ }
+
+ if (getCapacity() > 0 && getEnergyConsumption() > 0 && getSpeed() > 0) {
+ super.register(addon);
+ }
+ }
/**
* This method returns an internal identifier that is used to identify this {@link AContainer}
@@ -154,6 +254,7 @@ public abstract class AContainer extends SlimefunItem implements InventoryBlock,
*
* @return The identifier of this machine
*/
+ @Nonnull
public abstract String getMachineIdentifier();
/**
@@ -238,31 +339,30 @@ public abstract class AContainer extends SlimefunItem implements InventoryBlock,
BlockMenu inv = BlockStorage.getInventory(b);
if (isProcessing(b)) {
- int timeleft = progress.get(b);
- if (timeleft > 0) {
- ChestMenuUtils.updateProgressbar(inv, 22, timeleft, processing.get(b).getTicks(), getProgressBar());
+ if (takeCharge(b.getLocation())) {
- if (isChargeable()) {
- if (getCharge(b.getLocation()) < getEnergyConsumption()) {
- return;
+ int timeleft = progress.get(b);
+
+ if (timeleft > 0) {
+ ChestMenuUtils.updateProgressbar(inv, 22, timeleft, processing.get(b).getTicks(), getProgressBar());
+
+ progress.put(b, timeleft - 1);
+ } else {
+
+ inv.replaceExistingItem(22, new CustomItem(Material.BLACK_STAINED_GLASS_PANE, " "));
+
+ for (ItemStack output : processing.get(b).getOutput()) {
+ inv.pushItem(output.clone(), getOutputSlots());
}
- removeCharge(b.getLocation(), getEnergyConsumption());
+ Bukkit.getPluginManager().callEvent(new AsyncMachineProcessCompleteEvent(b.getLocation(), AContainer.this, getProcessing(b)));
+
+ progress.remove(b);
+ processing.remove(b);
}
- progress.put(b, timeleft - 1);
- } else {
- inv.replaceExistingItem(22, new CustomItem(Material.BLACK_STAINED_GLASS_PANE, " "));
-
- for (ItemStack output : processing.get(b).getOutput()) {
- inv.pushItem(output.clone(), getOutputSlots());
- }
-
- Bukkit.getPluginManager().callEvent(new AsyncMachineProcessCompleteEvent(b.getLocation(), AContainer.this, getProcessing(b)));
-
- progress.remove(b);
- processing.remove(b);
}
+
} else {
MachineRecipe next = findNextRecipe(inv);
@@ -273,6 +373,28 @@ public abstract class AContainer extends SlimefunItem implements InventoryBlock,
}
}
+ /**
+ * This method will remove charge from a location if it is chargeable.
+ *
+ * @param l
+ * location to try to remove charge from
+ * @return Whether charge was taken if its chargeable
+ */
+ protected boolean takeCharge(@Nonnull Location l) {
+ Validate.notNull(l, "Can't attempt to take charge from a null location!");
+
+ if (isChargeable()) {
+ if (getCharge(l) < getEnergyConsumption()) {
+ return false;
+ }
+
+ removeCharge(l, getEnergyConsumption());
+ return true;
+ } else {
+ return true;
+ }
+ }
+
protected MachineRecipe findNextRecipe(BlockMenu inv) {
Map inventory = new HashMap<>();
diff --git a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AGenerator.java b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AGenerator.java
index 43287a3d3..88f977920 100644
--- a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AGenerator.java
+++ b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AGenerator.java
@@ -3,8 +3,11 @@ package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems;
import java.util.HashMap;
import java.util.Map;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
+import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -15,7 +18,9 @@ import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
+import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
import io.github.thebusybiscuit.slimefun4.api.events.AsyncGeneratorProcessCompleteEvent;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemState;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.AbstractEnergyProvider;
@@ -42,6 +47,9 @@ public abstract class AGenerator extends AbstractEnergyProvider {
private static final int[] border_in = { 9, 10, 11, 12, 18, 21, 27, 28, 29, 30 };
private static final int[] border_out = { 14, 15, 16, 17, 23, 26, 32, 33, 34, 35 };
+ private int energyProducedPerTick = -1;
+ private int energyCapacity = -1;
+
@ParametersAreNonnullByDefault
public AGenerator(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
@@ -188,7 +196,7 @@ public abstract class AGenerator extends AbstractEnergyProvider {
}
}
- private boolean isBucket(ItemStack item) {
+ private boolean isBucket(@Nullable ItemStack item) {
if (item == null) {
return false;
}
@@ -210,4 +218,78 @@ public abstract class AGenerator extends AbstractEnergyProvider {
return null;
}
+ /**
+ * This method returns the max amount of electricity this machine can hold.
+ *
+ * @return The max amount of electricity this Block can store.
+ */
+ public int getCapacity() {
+ return energyCapacity;
+ }
+
+ /**
+ * This method returns the amount of energy that is consumed per operation.
+ *
+ * @return The rate of energy consumption
+ */
+ @Override
+ public int getEnergyProduction() {
+ return energyProducedPerTick;
+ }
+
+ /**
+ * This sets the energy capacity for this machine.
+ * This method must be called before registering the item
+ * and only before registering.
+ *
+ * @param capacity
+ * The amount of energy this machine can store
+ *
+ * @return This method will return the current instance of {@link AGenerator}, so that can be chained.
+ */
+ public final AGenerator setCapacity(int capacity) {
+ Validate.isTrue(capacity >= 0, "The capacity cannot be negative!");
+
+ if (getState() == ItemState.UNREGISTERED) {
+ this.energyCapacity = capacity;
+ return this;
+ } else {
+ throw new IllegalStateException("You cannot modify the capacity after the Item was registered.");
+ }
+ }
+
+ /**
+ * This method sets the energy produced by this machine per tick.
+ *
+ * @param energyProduced
+ * The energy produced per tick
+ *
+ * @return This method will return the current instance of {@link AGenerator}, so that can be chained.
+ */
+ public final AGenerator setEnergyProduction(int energyProduced) {
+ Validate.isTrue(energyProduced > 0, "The energy production must be greater than zero!");
+
+ this.energyProducedPerTick = energyProduced;
+ return this;
+ }
+
+ @Override
+ public void register(@Nonnull SlimefunAddon addon) {
+ this.addon = addon;
+
+ if (getCapacity() < 0) {
+ warn("The capacity has not been configured correctly. The Item was disabled.");
+ warn("Make sure to call '" + getClass().getSimpleName() + "#setEnergyCapacity(...)' before registering!");
+ }
+
+ if (getEnergyProduction() <= 0) {
+ warn("The energy consumption has not been configured correctly. The Item was disabled.");
+ warn("Make sure to call '" + getClass().getSimpleName() + "#setEnergyProduction(...)' before registering!");
+ }
+
+ if (getCapacity() >= 0 && getEnergyProduction() > 0) {
+ super.register(addon);
+ }
+ }
+
}
diff --git a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/interfaces/InventoryBlock.java b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/interfaces/InventoryBlock.java
index de0c283a3..8de896dc1 100644
--- a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/interfaces/InventoryBlock.java
+++ b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/interfaces/InventoryBlock.java
@@ -19,7 +19,7 @@ import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow;
* @deprecated This interface is not designed to be used by addons.
*
*/
-// @Deprecated - commented out because we are not ready to send out warnings yet
+@Deprecated
public interface InventoryBlock {
/**
diff --git a/src/main/java/me/mrCookieSlime/Slimefun/api/inventory/BlockMenuPreset.java b/src/main/java/me/mrCookieSlime/Slimefun/api/inventory/BlockMenuPreset.java
index 1a1a0ebb3..4c80fedb2 100644
--- a/src/main/java/me/mrCookieSlime/Slimefun/api/inventory/BlockMenuPreset.java
+++ b/src/main/java/me/mrCookieSlime/Slimefun/api/inventory/BlockMenuPreset.java
@@ -15,6 +15,7 @@ import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow;
@@ -122,6 +123,33 @@ public abstract class BlockMenuPreset extends ChestMenu {
throw new UnsupportedOperationException("BlockMenuPreset does not support this method.");
}
+ /**
+ * This method will draw unclickable background items into this {@link BlockMenuPreset}.
+ *
+ * @param item
+ * The {@link ItemStack} that should be used as background
+ * @param slots
+ * The slots which should be treated as background
+ */
+ public void drawBackground(@Nonnull ItemStack item, @Nonnull int[] slots) {
+ Validate.notNull(item, "The background item cannot be null!");
+ checkIfLocked();
+
+ for (int slot : slots) {
+ addItem(slot, item, ChestMenuUtils.getEmptyClickHandler());
+ }
+ }
+
+ /**
+ * This method will draw unclickable background items into this {@link BlockMenuPreset}.
+ *
+ * @param slots
+ * The slots which should be treated as background
+ */
+ public void drawBackground(@Nonnull int[] slots) {
+ drawBackground(ChestMenuUtils.getBackground(), slots);
+ }
+
@Override
public ChestMenu addItem(int slot, @Nullable ItemStack item) {
checkIfLocked();
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index bad81f55d..41c82a88a 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -37,10 +37,10 @@ URID:
networks:
max-size: 200
cargo-ticker-delay: 0
+ enable-visualizer: true
items:
talismans: true
- backpacks: true
soulbound: true
metrics:
diff --git a/src/main/resources/languages/categories_zh-TW.yml b/src/main/resources/languages/categories_zh-TW.yml
index 0ccd29ed4..69d1cbfb4 100644
--- a/src/main/resources/languages/categories_zh-TW.yml
+++ b/src/main/resources/languages/categories_zh-TW.yml
@@ -6,7 +6,7 @@ slimefun:
food: 食物
basic_machines: 基礎機器
electricity: 電力與能源
- gps: GPS機械
+ gps: GPS 機械
armor: 盔甲
magical_items: 魔法物品
magical_gadgets: 魔法工具
@@ -16,11 +16,11 @@ slimefun:
cargo: 物流管理
tech_misc: 科技組件
magical_armor: 魔法盔甲
- talismans: 護符(初級)
- ender_talismans: 護符(終界)
+ talismans: 護符(初級)
+ ender_talismans: 護符(終界)
christmas: 聖誕節
valentines_day: 西洋情人節
easter: 復活節
- birthday: TheBusyBiscuit的生日(10月26日)
+ birthday: TheBusyBiscuit 的生日(10 月 26 日)
halloween: 萬聖節
androids: 可編輯的機器人
diff --git a/src/main/resources/languages/messages_ar.yml b/src/main/resources/languages/messages_ar.yml
index 594a2774f..e3ef3db50 100644
--- a/src/main/resources/languages/messages_ar.yml
+++ b/src/main/resources/languages/messages_ar.yml
@@ -245,9 +245,9 @@ messages:
no-tome-yourself: "&cلا يمكنك إستعمال &4القاموس &cعلى نفسك..."
not-online: "&4%player% &cغير متصل!"
not-researched: "&4لا تملك خبرة لفهم هذا الأمر"
- not-valid-amount: "&4%amount% &cليست قيمة صحيحة: يجب أن تكون أكثر من صفر!"
- not-valid-item: "&4%item% &cليس عنصر صحيح!"
- not-valid-research: "&4%research% &cليس بحث صحيح!"
+ invalid-amount: "&4%amount% &cليست قيمة صحيحة: يجب أن تكون أكثر من صفر!"
+ invalid-item: "&4%item% &cليس عنصر صحيح!"
+ invalid-research: "&4%research% &cليس بحث صحيح!"
only-players: "&4هذا الأمر لللاعبين فقط"
opening-backpack: "&bيتم فتح الحقيبة، قد تستغرق ثوان..."
opening-guide: "&bيتم فتح الكتيب، قد يستغرق ثوان..."
diff --git a/src/main/resources/languages/messages_cs.yml b/src/main/resources/languages/messages_cs.yml
index 51b8b885b..89f93a40f 100644
--- a/src/main/resources/languages/messages_cs.yml
+++ b/src/main/resources/languages/messages_cs.yml
@@ -100,11 +100,11 @@ messages:
no-permission: "&4Na tohle nemáš dostatečné povolení"
usage: "&4Použití: &c%usage%"
not-online: "&4%player% &czrovna není připojen!"
- not-valid-item: "&4%item% &cnení platný item!"
- not-valid-amount: "&4%amount% &cnení platné číslo : musí být větší než 0!"
+ invalid-item: "&4%item% &cnení platný item!"
+ invalid-amount: "&4%amount% &cnení platné číslo : musí být větší než 0!"
given-item: '&bDostal jsi &a%amount% &7"%item%&7"'
give-item: '&bDal jsi %player% &a%amount% &7"%item%&7"'
- not-valid-research: "&4%research% &cnení platný výzkum!"
+ invalid-research: "&4%research% &cnení platný výzkum!"
give-research: '&bUdělil jsi %player% výzkum &7"%research%&7"'
hungry: "&cJsi moc hladový na to, abys to zvládl!"
disabled-in-world: "&4&lTahle věc není v tomhle světě povolená"
diff --git a/src/main/resources/languages/messages_de.yml b/src/main/resources/languages/messages_de.yml
index b45b3b598..7ef8cd8b1 100644
--- a/src/main/resources/languages/messages_de.yml
+++ b/src/main/resources/languages/messages_de.yml
@@ -108,11 +108,11 @@ messages:
no-permission: "&4Du hast nicht die benötigten Rechte hierfür"
usage: "&4Korrekte Schreibweise: &c%usage%"
not-online: "&4%player% &cist derzeit nicht online!"
- not-valid-item: "&4%item% &cist kein gültiges Item!"
- not-valid-amount: "&4%amount% &cist keine gültige Anzahl! Sie muss höher als 0 sein!"
+ invalid-item: "&4%item% &cist kein gültiges Item!"
+ invalid-amount: "&4%amount% &cist keine gültige Anzahl! Sie muss höher als 0 sein!"
given-item: '&bDir wurde &a%amount% &7mal "%item%&7" gegeben'
give-item: '&bDu hast %player% &a%amount% &7"%item%&7" gegeben'
- not-valid-research: "&4%research% &cist kein gültiger Erfahrungsgrad!"
+ invalid-research: "&4%research% &cist kein gültiger Erfahrungsgrad!"
give-research: '&bDu hast %player% den Erfahrungsgrad &7"%research%&7" vergeben'
hungry: "&cDu bist zu hungrig, um dies zu tun!"
disabled-in-world: "&4&lDieses Item wurde in dieser Welt deaktiviert!"
diff --git a/src/main/resources/languages/messages_en.yml b/src/main/resources/languages/messages_en.yml
index c2097f97b..024c89b6b 100644
--- a/src/main/resources/languages/messages_en.yml
+++ b/src/main/resources/languages/messages_en.yml
@@ -120,11 +120,11 @@ messages:
no-permission: '&4You do not have the required permission to do this'
usage: '&4Usage: &c%usage%'
not-online: '&4%player% &cis not online!'
- not-valid-item: '&4%item% &cis not a valid Item!'
- not-valid-amount: '&4%amount% &cis not a valid amount : it must be higher than 0!'
+ invalid-item: '&4%item% &cis not a valid Item!'
+ invalid-amount: '&4%amount% &cis not a valid amount : it must be higher than 0!'
given-item: '&bYou have been given &a%amount% &7"%item%&7"'
give-item: '&bYou have given %player% &a%amount% &7"%item%&7"'
- not-valid-research: '&4%research% &cis not a valid Research!'
+ invalid-research: '&4%research% &cis not a valid Research!'
give-research: '&bYou have given %player% the Research &7"%research%&7"'
hungry: '&cYou are too hungry to do that!'
disabled-in-world: '&4&lThis Item has been disabled in this world'
diff --git a/src/main/resources/languages/messages_es.yml b/src/main/resources/languages/messages_es.yml
index 0629e3429..a9c282018 100644
--- a/src/main/resources/languages/messages_es.yml
+++ b/src/main/resources/languages/messages_es.yml
@@ -102,12 +102,12 @@ messages:
no-permission: "&4No tienes el permiso requerido para hacer esto."
usage: "&4Uso: &c%usage%"
not-online: "&c¡&4%player% &cno está conectado!"
- not-valid-item: "&c¡&4%item% &cno es un objeto válido!"
- not-valid-amount: "&c¡&4%amount% &cno es un valor válido: tiene que ser mayor a
+ invalid-item: "&c¡&4%item% &cno es un objeto válido!"
+ invalid-amount: "&c¡&4%amount% &cno es un valor válido: tiene que ser mayor a
0!"
given-item: '&bTe han dado &a%amount% &7"%item%&7"'
give-item: '&bLe has dado a %player%, &a%amount% &7"%item%&7"'
- not-valid-research: "&c¡&4%research% &cno es un conocimiento válido!"
+ invalid-research: "&c¡&4%research% &cno es un conocimiento válido!"
give-research: '&bLe has dado a %player% la investigación &7"%research%&7"'
hungry: "&c¡Tienes demasiada hambre para hacer eso!"
disabled-in-world: "&4&lEste item ha sido desactivado en el mundo."
diff --git a/src/main/resources/languages/messages_fr.yml b/src/main/resources/languages/messages_fr.yml
index 797238f77..45789bdf8 100644
--- a/src/main/resources/languages/messages_fr.yml
+++ b/src/main/resources/languages/messages_fr.yml
@@ -110,12 +110,12 @@ messages:
no-permission: "&4Vous n'avez pas les permissions requises pour faire ceci"
usage: "&4Utilisation: &c%usage%"
not-online: "&4%player% &cn'est pas en ligne!"
- not-valid-item: "&4%item% &cn'est pas un item valide!"
- not-valid-amount: "&4%amount% &cn'est pas un montant valide: il doit être supérieur
+ invalid-item: "&4%item% &cn'est pas un item valide!"
+ invalid-amount: "&4%amount% &cn'est pas un montant valide: il doit être supérieur
à 0!"
given-item: '&bVous avez reçu &a%amount%&7 "%item%&7"'
give-item: '&bVous avez donné &a%amount% &7"%item%&7" à %player%'
- not-valid-research: "&4%research% &cn'est pas une recherche valide!"
+ invalid-research: "&4%research% &cn'est pas une recherche valide!"
give-research: '&bVous avez débloqué la recherche "%research%&7" à %player%'
hungry: "&cVous avez trop faim pour faire ça!"
disabled-in-world: "&4&lCet item a été désactivé dans ce monde"
diff --git a/src/main/resources/languages/messages_hu.yml b/src/main/resources/languages/messages_hu.yml
index 8320c757b..cff22a025 100644
--- a/src/main/resources/languages/messages_hu.yml
+++ b/src/main/resources/languages/messages_hu.yml
@@ -106,11 +106,11 @@ messages:
no-permission: "&4Ehhez nincs jogod"
usage: "&4Használat: &c%usage%"
not-online: "&4%player% &cjelenleg nem elérhető!"
- not-valid-item: "&4%item% &cnem megfelelő tárgy!"
- not-valid-amount: "&4%amount% &cnem megfelelő mennyiség: 0-nál nagyobbnak kell lennie!"
+ invalid-item: "&4%item% &cnem megfelelő tárgy!"
+ invalid-amount: "&4%amount% &cnem megfelelő mennyiség: 0-nál nagyobbnak kell lennie!"
given-item: '&bKaptál &a%amount% darab &7"%item%&7"&b-t'
give-item: '&bAdtál %player%-nek/nak &a%amount% &7"%item%&7"&b-t'
- not-valid-research: "&4%research% &cnem érvényes Kutatás!"
+ invalid-research: "&4%research% &cnem érvényes Kutatás!"
give-research: '&bMegadtad %player% játékosnak a(z) &7"%research%&7" &bkutatást'
hungry: "&cTúl éhes vagy ehhez!"
disabled-in-world: "&4&lEz a tárgy tiltva van ebben a világban"
@@ -244,6 +244,7 @@ machines:
finished: Az Industrial Miner-ed kész! Összesen %ores% ércet szerzett!
anvil:
not-working: "&4Nem használhatsz Slimefun tárgyakat az üllőben!"
+ mcmmo-salvaging: "&4Nem hasznosíthatsz újra Slimefun tárgyakat!"
backpack:
already-open: "&cSajnáljuk, ez a hátizsák valahol máshol már nyitva van!"
no-stack: "&cNem halmozhatsz hátizsákokat"
@@ -306,7 +307,7 @@ android:
rating:
own: "&4Nem értékelheted a saját szkriptedet!"
already: "&4Ezt a szkriptet már értékelted!"
- editor: Szkript Szerkesztő
+ editor: Szkript szerkesztő
languages:
default: Szerver-alapértelmezett
en: Angol
@@ -328,7 +329,6 @@ languages:
zh-CN: Kínai (Kína)
el: Görög
he: Héber
- pt-BR: Portugál (Brazília)
ar: Arab
af: Afrikaans
da: Dán
@@ -341,6 +341,7 @@ languages:
th: Thai
ro: Román
pt: Portugál (Portugália)
+ pt-BR: Portugál (Brazília)
bg: Bolgár
ko: Koreai
tr: Török
@@ -355,5 +356,7 @@ villagers:
no-trading: "&4Nem cserélhetsz Slimefun tárgyakat falusiakkal!"
cartography_table:
not-working: "&4Nem használhatsz Slimefun tárgyakat térképasztalban."
+cauldron:
+ no-discoloring: "&4Nem színteleníthetsz Slimefun páncélt!"
miner:
no-ores: "&eSajnálom, nem találtam semmilyen ércet a közelben!"
diff --git a/src/main/resources/languages/messages_id.yml b/src/main/resources/languages/messages_id.yml
index 033a0c516..f7ff26158 100644
--- a/src/main/resources/languages/messages_id.yml
+++ b/src/main/resources/languages/messages_id.yml
@@ -83,11 +83,11 @@ messages:
no-permission: "&4Anda Tidak Memiliki Izin Untuk Ini"
usage: "&4Penggunaan: &c%usage%"
not-online: "&4%player% &cTidak Sedang Bermain Disini!"
- not-valid-item: "&4%item% &cBenda Ini Tidak sah"
- not-valid-amount: "&4%amount% &cJumlah Ini Salah : Harus Lebih Tinggi Dari 0!"
+ invalid-item: "&4%item% &cBenda Ini Tidak sah"
+ invalid-amount: "&4%amount% &cJumlah Ini Salah : Harus Lebih Tinggi Dari 0!"
given-item: '&bAnda Telah Diberikan &a%amount% &7"%item%&7"'
give-item: '&bAnda Telah Memberi %player% &a%amount% &7"%item%&7"'
- not-valid-research: "&4%research% &cIni Bukan Penelitian Yang Benar!"
+ invalid-research: "&4%research% &cIni Bukan Penelitian Yang Benar!"
give-research: '&bAnda Telah Memberi %player% Penelitian &7"%research%&7"'
hungry: "&cAnda Terlalu Lapar Untuk Ini "
mode-change: "&b%device% Mode Telah Berubah Menjadi: &9%mode%"
diff --git a/src/main/resources/languages/messages_it.yml b/src/main/resources/languages/messages_it.yml
index 4ab431a8c..aba2ae226 100644
--- a/src/main/resources/languages/messages_it.yml
+++ b/src/main/resources/languages/messages_it.yml
@@ -249,9 +249,9 @@ messages:
no-tome-yourself: "&cNon puoi utilizzare il &4Tomo della conoscienza &c su te stesso
..."
not-online: "&4%player% &cnon è online!"
- not-valid-amount: "&4%amount% &cnon è una valida quantità: deve essere maggiore
+ invalid-amount: "&4%amount% &cnon è una valida quantità: deve essere maggiore
di 0!"
- not-valid-research: "&4%research% &cnon è una ricerca valida!"
+ invalid-research: "&4%research% &cnon è una ricerca valida!"
only-players: "&4Questo comando è solo per i players"
opening-backpack: "&bAprendo lo zaino, potrebbero essere necessari alcuni secondi
..."
@@ -282,7 +282,7 @@ messages:
unlocked: '&bHai sbloccato &7 "%research%"'
usage: "&4Utilizzo: &c%usage%"
not-researched: "&4Non hai abbastanza conoscenze per capirlo!"
- not-valid-item: "&4%item% &cnon è un oggetto valido!"
+ invalid-item: "&4%item% &cnon è un oggetto valido!"
disabled-in-world: "&4&lQuesto oggetto è stato disattivato in questo mondo!"
disabled-item: "&4& lQuesto oggetto è stato disabilitato! Come l'hai ottenuto?"
radiation: "&4Sei stato esposto a radiazioni mortali! &cSbarazzati dell'oggetto
diff --git a/src/main/resources/languages/messages_ja.yml b/src/main/resources/languages/messages_ja.yml
index c34c65548..a38e85db9 100644
--- a/src/main/resources/languages/messages_ja.yml
+++ b/src/main/resources/languages/messages_ja.yml
@@ -106,11 +106,11 @@ messages:
no-permission: "&4権限がありません"
usage: "&4使用法: &c%usage%"
not-online: "&4%player% &cはオンラインではありません!"
- not-valid-item: "&4%item% &cは正しくないアイテムです"
- not-valid-amount: "&4%amount% &cの部分には、正の整数を指定してください"
+ invalid-item: "&4%item% &cは正しくないアイテムです"
+ invalid-amount: "&4%amount% &cの部分には、正の整数を指定してください"
given-item: "&b%item%を%amount%個与えられました"
give-item: "&b%player%に%item%を%amount%個与えました"
- not-valid-research: "&4%research%&cは正しくないリサーチです"
+ invalid-research: "&4%research%&cは正しくないリサーチです"
give-research: "&b%player%のリサーチ%research%を完了させました"
hungry: "&c空腹のため使えません"
disabled-in-world: "&4&lこのワールドでは使用できません"
diff --git a/src/main/resources/languages/messages_ko.yml b/src/main/resources/languages/messages_ko.yml
index a160b4358..ad0290582 100644
--- a/src/main/resources/languages/messages_ko.yml
+++ b/src/main/resources/languages/messages_ko.yml
@@ -90,11 +90,11 @@ messages:
no-permission: "&4이 작업에 필요한 권한이 없습니다."
usage: "&4사용량: &c%usage%\n"
not-online: "&4%player% &cis가 온라인 상태가 아닙니다!"
- not-valid-item: "&4%item% &cis가 올바른 아이템이 아닙니다!"
- not-valid-amount: "&4%amount% &cis 유효한 금액이 아닙니다. 0보다 커야 합니다!"
+ invalid-item: "&4%item% &cis가 올바른 아이템이 아닙니다!"
+ invalid-amount: "&4%amount% &cis 유효한 금액이 아닙니다. 0보다 커야 합니다!"
given-item: '&b당신은 &a%amount% &7"%item%&7"을 받았다.'
give-item: '&b%player% &a%amount% &7"%item%&7"을(를) 제공하셨습니다.'
- not-valid-research: "&4%research% &cis가 유효하지 않은 연구!\n"
+ invalid-research: "&4%research% &cis가 유효하지 않은 연구!\n"
give-research: '&b%player%에 Research &7"%research%&7"을(를) 제공했습니다.
'
diff --git a/src/main/resources/languages/messages_lv.yml b/src/main/resources/languages/messages_lv.yml
index de6d2c82b..8e4ce69f6 100644
--- a/src/main/resources/languages/messages_lv.yml
+++ b/src/main/resources/languages/messages_lv.yml
@@ -56,11 +56,11 @@ messages:
no-permission: "&4Tev šo nav atļauts darīt"
usage: "&4Pamācība: &c%usage%"
not-online: "&4%player%&c nav pieslēdzies!"
- not-valid-item: "&4%item% &cneeksistē!"
- not-valid-amount: "&4%amount% &cnav pareizs daudzums : tam jābūt lielākam par 0!"
+ invalid-item: "&4%item% &cneeksistē!"
+ invalid-amount: "&4%amount% &cnav pareizs daudzums : tam jābūt lielākam par 0!"
given-item: '&bTev iedeva &a%amount% &7"%item%&7"'
give-item: '&bTu iedevi %player% &a%amount% &7"%item%&7"'
- not-valid-research: "&4%research% &cis nav eksistējošs atklājums!"
+ invalid-research: "&4%research% &cis nav eksistējošs atklājums!"
give-research: '&bTu iedevi %player% atklājumu ar nosaukumu &7"%research%&7"'
hungry: "&cTu esi pārāk izsalcis, lai šo darītu!"
mode-change: "&b%device% režīms nomainīts uz &9%mode%"
diff --git a/src/main/resources/languages/messages_nl.yml b/src/main/resources/languages/messages_nl.yml
index 2589909bd..199735711 100644
--- a/src/main/resources/languages/messages_nl.yml
+++ b/src/main/resources/languages/messages_nl.yml
@@ -83,12 +83,12 @@ messages:
no-permission: "&4Je hebt geen toestemming om deze actie uit te voeren"
usage: "&4Gebruik, zoals: &c%usage%"
not-online: "&4%player% &cis niet online!"
- not-valid-item: "&4%item% &cis geen geldig voorwerp!"
- not-valid-amount: "&4%amount% &cis geen geldige hoeveelheid: het moet meer zijn
+ invalid-item: "&4%item% &cis geen geldig voorwerp!"
+ invalid-amount: "&4%amount% &cis geen geldige hoeveelheid: het moet meer zijn
dan 0!"
given-item: '&bJe hebt &a%amount% keer &7"%item%&7" ontvangen'
give-item: '&bJe hebt %player% &a%amount% keer &7"%item%&7" gegeven'
- not-valid-research: "&4%research% &cis geen geldig Slimefun onderzoek"
+ invalid-research: "&4%research% &cis geen geldig Slimefun onderzoek"
give-research: '&bJe hebt %player% de kennis over &7"%research%&7" gegeven'
hungry: "&cJe hebt teveel honger om zoiets te doen!"
disabled-in-world: "&4&lDit voorwerp is uitgeschakeld in deze wereld"
diff --git a/src/main/resources/languages/messages_pl.yml b/src/main/resources/languages/messages_pl.yml
index 1cff0f74c..108aaaaee 100644
--- a/src/main/resources/languages/messages_pl.yml
+++ b/src/main/resources/languages/messages_pl.yml
@@ -81,12 +81,12 @@ messages:
no-permission: "&4Brak uprawnień"
usage: "&4Użycie: &c%usage%"
not-online: "&4%player% &cnie jest online!"
- not-valid-item: "&4%item% &cnie jest poprawnym przedmiotem!"
- not-valid-amount: "&4%amount% &cnie jest prawidłową ilością: ilość musi być większa
+ invalid-item: "&4%item% &cnie jest poprawnym przedmiotem!"
+ invalid-amount: "&4%amount% &cnie jest prawidłową ilością: ilość musi być większa
od 0!"
given-item: '&bOtrzymano &a%amount% &7"%item%&7"'
give-item: '&bDodano przedmiot do plecaka gracza %player%: &a%amount% &7"%item%&7"'
- not-valid-research: "&4%research% &cnie jest poprawnym Badaniem!"
+ invalid-research: "&4%research% &cnie jest poprawnym Badaniem!"
give-research: '&bOdblokowano badanie &7"%research%&7" dla gracza %player%'
hungry: "&cJesteś zbyt głodny, żeby to zrobić!"
mode-change: "&bTryb urządzenia %device% został zmieniony na: &9%mode%"
diff --git a/src/main/resources/languages/messages_pt-BR.yml b/src/main/resources/languages/messages_pt-BR.yml
index 995c26915..df1a164f5 100644
--- a/src/main/resources/languages/messages_pt-BR.yml
+++ b/src/main/resources/languages/messages_pt-BR.yml
@@ -237,10 +237,10 @@ messages:
no-tome-yourself: "&cVocê não pode usar o &4Tomo do Conhecimento &cem si mesmo..."
not-online: "&4%player% &cnão está online!"
not-researched: "&4Você não tem conhecimento suficiente para entender sobre isso."
- not-valid-amount: "&4%amount% &cnão é uma quantidade válida (precisa ser maior que
+ invalid-amount: "&4%amount% &cnão é uma quantidade válida (precisa ser maior que
0)!"
- not-valid-item: "&4%item% &cnão é um item válido!"
- not-valid-research: "&4%research% &cnão é uma Pesquisa válida!"
+ invalid-item: "&4%item% &cnão é um item válido!"
+ invalid-research: "&4%research% &cnão é uma Pesquisa válida!"
only-players: "&4Este comando é apenas para jogadores"
opening-backpack: "&bAbrindo a mochila, isso pode levar alguns segundos..."
opening-guide: "&bAbrindo o guia, isso pode levar alguns segundos..."
diff --git a/src/main/resources/languages/messages_ru.yml b/src/main/resources/languages/messages_ru.yml
index addbf80bb..5b3643cd9 100644
--- a/src/main/resources/languages/messages_ru.yml
+++ b/src/main/resources/languages/messages_ru.yml
@@ -107,12 +107,12 @@ messages:
no-permission: "&4У Вас недостаточно прав, чтобы сделать это"
usage: "&4Использование: &c%usage%"
not-online: "&4%player% &cсейчас не в игре!"
- not-valid-item: "&4%item% &cне является допустимым предметом!"
- not-valid-amount: "&4%amount% &cне является допустимым числом: количество должно
+ invalid-item: "&4%item% &cне является допустимым предметом!"
+ invalid-amount: "&4%amount% &cне является допустимым числом: количество должно
быть больше нуля!"
given-item: '&bВам выдали &a%amount% &7"%item%&7"'
give-item: '&bВы выдали игроку %player% &a%amount% &7"%item%&7"'
- not-valid-research: "&4%research% &cне является допустимым исследованием!"
+ invalid-research: "&4%research% &cне является допустимым исследованием!"
give-research: '&bВы выдали игроку %player% исследование &7"%research%&7"'
hungry: "&cВы слишком голодны для этого!"
disabled-in-world: "&4&lДанный предмет отключен в этом мире"
diff --git a/src/main/resources/languages/messages_sk.yml b/src/main/resources/languages/messages_sk.yml
index 1d2279149..23ea80a91 100644
--- a/src/main/resources/languages/messages_sk.yml
+++ b/src/main/resources/languages/messages_sk.yml
@@ -251,9 +251,9 @@ messages:
no-tome-yourself: "&cNemôžeš použiť &4Knihu vedomostí &cna seba..."
not-online: "&4%player% &cnie je online!"
not-researched: "&4Nemáš toľko vedomostí aby si tomu porozumel"
- not-valid-amount: "&4%amount% &cnie je platné množstvo: Musí byť väčšie ako 0!"
- not-valid-item: "&4%item% &cnie je platný item!"
- not-valid-research: "&4%research% &cnie je platný výskum!"
+ invalid-amount: "&4%amount% &cnie je platné množstvo: Musí byť väčšie ako 0!"
+ invalid-item: "&4%item% &cnie je platný item!"
+ invalid-research: "&4%research% &cnie je platný výskum!"
only-players: "&4Tento príkaz je iba pre hráčov"
opening-backpack: "&bOtváram batoh, môže to trvať pár sekúnd..."
opening-guide: "&bOtváram príručku, môže to trvať pár sekúnd..."
diff --git a/src/main/resources/languages/messages_sv.yml b/src/main/resources/languages/messages_sv.yml
index 54a258473..99a7d7a9c 100644
--- a/src/main/resources/languages/messages_sv.yml
+++ b/src/main/resources/languages/messages_sv.yml
@@ -250,10 +250,10 @@ messages:
no-tome-yourself: "&cDu kan inte använda &4Tome of Knowledge &cpå dig själv"
not-online: "&4%player% &cär inte online!"
not-researched: "&4Du har inte tillräckligt mycket kunskap för att förstå detta"
- not-valid-amount: "&4%amount% &cär inget giltigt antal : det måste vara större än
+ invalid-amount: "&4%amount% &cär inget giltigt antal : det måste vara större än
noll!"
- not-valid-item: "&4%item% &cär inget giltigt föremål!"
- not-valid-research: "&4%research% &cär ingen giltig forskning!"
+ invalid-item: "&4%item% &cär inget giltigt föremål!"
+ invalid-research: "&4%research% &cär ingen giltig forskning!"
only-players: "&4Detta kommando är endast för spelare"
opening-backpack: "&bÖppnar ryggsäck. Detta kan ta några sekunder..."
opening-guide: "&bÖppnar handboken. Detta kan ta några sekunder..."
diff --git a/src/main/resources/languages/messages_th.yml b/src/main/resources/languages/messages_th.yml
index c6dab712c..aac31598d 100644
--- a/src/main/resources/languages/messages_th.yml
+++ b/src/main/resources/languages/messages_th.yml
@@ -75,8 +75,8 @@ messages:
unknown-player: "&4ไม่รู้จักผู้เล่น: &c%player%"
no-permission: "&4คุณต้องได้รับ permission เพื่อกระทำสิ่งนี้"
not-online: "&4%player% &cไม่ได้ออนไลน์!"
- not-valid-item: "&4%item% &cไม่ใช่ไอเทมที่ถูกต้อง!"
- not-valid-amount: "&4%amount% &cไม่ใช่จำนวนที่ถูกต้อง : ตัวเลขควรมากกว่า 0!"
+ invalid-item: "&4%item% &cไม่ใช่ไอเทมที่ถูกต้อง!"
+ invalid-amount: "&4%amount% &cไม่ใช่จำนวนที่ถูกต้อง : ตัวเลขควรมากกว่า 0!"
given-item: '&bคุณได้เสก &7"%item%&7" &ax%amount%'
give-item: '&bคุณได้เสก &7"%item%&7" &ax%amount% ให้กับ %player%'
hungry: "&cคุณหิวเกินไปจะทำเช่นนั้น!"
@@ -100,7 +100,7 @@ messages:
not-researched: "&4คุณมีความรู้ไม่เพียงพอที่จะเข้าใจสิ่งนี้"
not-enough-xp: "&4คุณมี XP ไม่เพียงพอที่จะปลดล็อก"
usage: "&4วิธีใช้: &c%usage%"
- not-valid-research: "&4%research% &cนี้ไม่ใช่คำสำหรับการค้นหา!"
+ invalid-research: "&4%research% &cนี้ไม่ใช่คำสำหรับการค้นหา!"
give-research: '&bคุณได้ให้ %player% เรียนรู้&7"%research%&7"'
mode-change: "&b%device% เปลี่ยนโหมดเป็น: &9%mode%"
disabled-item: "&4&lไอเท็มถูกปิดการใช้งาน! คุณเอาไอเท็มมาจากไหน?"
diff --git a/src/main/resources/languages/messages_tl.yml b/src/main/resources/languages/messages_tl.yml
index cb9531d74..3075f703a 100644
--- a/src/main/resources/languages/messages_tl.yml
+++ b/src/main/resources/languages/messages_tl.yml
@@ -105,12 +105,12 @@ messages:
no-permission: "&4Wala kang permiso para gawin ito."
usage: "&4Paggamit: &c%usage%"
not-online: "&cHindi online si &4%player%!"
- not-valid-item: "&cHindi valid ang &4%item%!"
- not-valid-amount: "&cHindi valid ang amount na &4%amount% : dapat ito'y mas mataas
+ invalid-item: "&cHindi valid ang &4%item%!"
+ invalid-amount: "&cHindi valid ang amount na &4%amount% : dapat ito'y mas mataas
kaysa sa 0!"
given-item: '&bIka''y binigyan ng &a%amount% &7"%item%&7"'
give-item: '&bBinigyan mo si %player% ng &a%amount% &7"%item%&7"'
- not-valid-research: "&4%research% &cay hindi valid na Research!"
+ invalid-research: "&4%research% &cay hindi valid na Research!"
give-research: '&bBinigyan mo si %player% ng Research &7"%research%&7"'
hungry: "&cIkaw ay sobrang gutom para gawin ito!"
disabled-in-world: "&4&lDinisable ang Aytem sa world na ito."
diff --git a/src/main/resources/languages/messages_tr.yml b/src/main/resources/languages/messages_tr.yml
index b919a99d0..fa2955464 100644
--- a/src/main/resources/languages/messages_tr.yml
+++ b/src/main/resources/languages/messages_tr.yml
@@ -108,11 +108,11 @@ messages:
no-permission: "&4Bunu yapmak için gerekli izniniz yok"
usage: "&4Kullanış: &c%usage%"
not-online: "&4%player% &coyunda değil!"
- not-valid-item: "&4%item% &cgeçerli bir eşya değil!"
- not-valid-amount: "&4%amount% &cgeçerli bir miktar değil : 0 dan büyük olmalı!"
+ invalid-item: "&4%item% &cgeçerli bir eşya değil!"
+ invalid-amount: "&4%amount% &cgeçerli bir miktar değil : 0 dan büyük olmalı!"
given-item: '&a%amount% &badet &7"%item%&7" &bsana verildi.'
give-item: '&b%player% adlı oyuncuya &a%amount% &badet &7"%item%&7" &bverdin.'
- not-valid-research: "&4%research% &cgeçerli bir araştırma değil!"
+ invalid-research: "&4%research% &cgeçerli bir araştırma değil!"
give-research: '&b%player% adlı oyuncu için bir araştırmayı açtın: &7"%research%&7"'
hungry: "&cBunu yapmak için çok açsın!"
disabled-in-world: "&4&lBu eşya bu dünyada devre dışı bırakıldı."
diff --git a/src/main/resources/languages/messages_uk.yml b/src/main/resources/languages/messages_uk.yml
index cf34438e5..4c73a7570 100644
--- a/src/main/resources/languages/messages_uk.yml
+++ b/src/main/resources/languages/messages_uk.yml
@@ -84,12 +84,12 @@ messages:
no-permission: "&4У Вас недостатньо прав для цього"
usage: "&4Використання: &c%usage%"
not-online: "&4%player% &cзараз не знаходиться у грі!"
- not-valid-item: "&4%item% &cне є достовірним предметом!"
- not-valid-amount: "&4%amount% &cне є допустимою кількістю: значення повинно бути
+ invalid-item: "&4%item% &cне є достовірним предметом!"
+ invalid-amount: "&4%amount% &cне є допустимою кількістю: значення повинно бути
більшим за 0!"
given-item: '&bВам видали &a%amount% &7"%item%&7"'
give-item: '&bВи видали гравцю %player% &a%amount% &7"%item%&7"'
- not-valid-research: "&4%research% &cне є правильним дослідженням!"
+ invalid-research: "&4%research% &cне є правильним дослідженням!"
give-research: '&bВи видали грацю %player% дослідження &7"%research%&7"'
hungry: "&cВи занадто голодні для цього!"
mode-change: "&b%device% | Режим змінено на: &9%mode%"
diff --git a/src/main/resources/languages/messages_vi.yml b/src/main/resources/languages/messages_vi.yml
index 1c6234769..0cdcc4902 100644
--- a/src/main/resources/languages/messages_vi.yml
+++ b/src/main/resources/languages/messages_vi.yml
@@ -273,9 +273,9 @@ messages:
no-tome-yourself: "&cBạn không thể sử dụng &4Bộ kiến thức &ccho chính bạn..."
not-online: "&4%player% &cđang không trực tuyến!"
not-researched: "&4Bạn không có đủ kiến thức để hiểu điều này"
- not-valid-amount: "&4%amount% &ckhông hợp lệ : phải lớn hơn 0!"
- not-valid-item: "&4%item% &ckhông phải là vật phẩm hợp lệ!"
- not-valid-research: "&4%research% &ckhông phải là nghiên cứu hợp lệ!"
+ invalid-amount: "&4%amount% &ckhông hợp lệ : phải lớn hơn 0!"
+ invalid-item: "&4%item% &ckhông phải là vật phẩm hợp lệ!"
+ invalid-research: "&4%research% &ckhông phải là nghiên cứu hợp lệ!"
only-players: "&4Lệnh này chỉ dành cho người chơi"
opening-backpack: "&bĐang mở ba lô, việc này có thể mất một vài giây..."
opening-guide: "&bĐang mở hướng dẫn, việc này có thể mất một vài giây..."
diff --git a/src/main/resources/languages/messages_zh-CN.yml b/src/main/resources/languages/messages_zh-CN.yml
index b0b631128..2b1cf8558 100644
--- a/src/main/resources/languages/messages_zh-CN.yml
+++ b/src/main/resources/languages/messages_zh-CN.yml
@@ -20,6 +20,10 @@ commands:
player-never-joined: "&4找不到叫这个名字的玩家!"
backpack-does-not-exist: "&4你指定的背包不存在!"
restored-backpack-given: "&a你的背包已被恢复并且已经放入了你的物品栏!"
+ charge:
+ description: 为你手持的物品充电
+ charge-success: 充电完成!
+ not-rechargeable: 这个物品不能充电!
guide:
search:
message: "&b你想要搜索什么?"
@@ -102,11 +106,11 @@ messages:
no-permission: "&4你没有足够的权限做这个"
usage: "&4用法: &c%usage%"
not-online: "&4%player% &c不在线"
- not-valid-item: "&4%item% &c不是一个有效的物品名!"
- not-valid-amount: "&4%amount% &ci不是一个有效的数字 : 它必须大于 0!"
+ invalid-item: "&4%item% &c不是一个有效的物品名!"
+ invalid-amount: "&4%amount% &ci不是一个有效的数字 : 它必须大于 0!"
given-item: '&b你获得了 &a%amount% &7"%item%&7"'
give-item: '&b成功给予玩家 %player% &a%amount% &7"%item%&7"'
- not-valid-research: "&4%research% &c不是一个有效的研究名!"
+ invalid-research: "&4%research% &c不是一个有效的研究名!"
give-research: '&b你成功解锁了玩家 %player% 的研究 &7"%research%&7"'
hungry: "&c你太饿了, 先吃点东西再试试吧!"
disabled-in-world: "&4&l这个物品在此世界已被禁用"
@@ -127,6 +131,7 @@ messages:
knight: "&a&o你的护身符给予了你 5 秒的生命恢复"
whirlwind: "&a&o你的护身符反弹了所有的弹射物"
wizard: "&a&o你的护身符使一个附魔的等级提高了, 同时其他附魔等级将会下降"
+ caveman: "&a&o你的护身符给予了你急迫效果"
soulbound-rune:
fail: "&c一次只能灵魂绑定一个物品."
success: "&a物品绑定成功! 在你死亡后此物品将不会掉落."
@@ -223,6 +228,7 @@ machines:
finished: "&e你的工业矿机采矿已完成! 总共开采了 %ores% 个矿石!"
anvil:
not-working: "&4你不能在铁砧里使用 Slimefun 的物品"
+ mcmmo-salvaging: "&4你不能分解 Slimefun 物品!"
backpack:
already-open: "&c抱歉, 这个背包已在别处打开了!"
no-stack: "&c你不能同时手持两个背包"
@@ -331,5 +337,9 @@ brewing_stand:
not-working: "&4你不能在酿造台中使用 Slimefun 物品!"
villagers:
no-trading: "&4你不能用 Slimefun 的物品和村民交易!"
+cartography_table:
+ not-working: "&4你不能在制图台中使用 Slimefun 物品!"
+cauldron:
+ no-discoloring: "&4你不能用炼药锅清洗 Slimefun 物品上的颜色"
miner:
no-ores: "&e抱歉, 周围找不到矿石了!"
diff --git a/src/main/resources/languages/messages_zh-TW.yml b/src/main/resources/languages/messages_zh-TW.yml
index 26b65a0d6..213143cd2 100644
--- a/src/main/resources/languages/messages_zh-TW.yml
+++ b/src/main/resources/languages/messages_zh-TW.yml
@@ -12,20 +12,24 @@ commands:
stats: 顯示玩家的統計數據
research:
description: 解鎖/重置玩家的研究項目
- reset: "&c你已使%player%變回智障"
+ reset: "&c你已使%player%變回笨蛋"
reset-target: "&c你變回笨蛋了"
backpack:
description: 檢索已存在背包的副本
- invalid-id: "&4ID不能是負數!"
- player-never-joined: "&4找不到該ID的玩家"
- backpack-does-not-exist: "&4該背包不存在!"
- restored-backpack-given: "&a你的背包已被修復並放到你的物品欄中!"
+ invalid-id: "&4ID不能是負數!"
+ player-never-joined: "&4找不到該名稱的玩家"
+ backpack-does-not-exist: "&4該背包不存在!"
+ restored-backpack-given: "&a你的背包已被修復並放到你的物品欄中!"
+ charge:
+ description: 為你手中的物品充電
+ charge-success: 此物品已充電完成!
+ not-rechargeable: 此物品不可被充電!
guide:
search:
- message: "&c你要搜尋什麼?"
+ message: "&c你要搜尋什麼?"
name: "&7搜尋..."
tooltip: "&b點擊以尋找物品"
- inventory: '尋找: %item%'
+ inventory: 搜尋:%item%
lore:
- "&b您要搜尋什麼?"
- "&7請輸入搜尋字句到聊天"
@@ -34,11 +38,17 @@ guide:
languages:
updated: "&a你的語言已改成: &b%lang%"
translations:
- name: "&a缺少什麼嗎?"
+ name: "&a缺少什麼嗎?"
lore: 點擊增加您自己的翻譯
select: 點擊選擇此語言
- select-default: 點擊選擇默認語言
+ select-default: 點擊選擇預設語言
selected-language: 當前選擇:
+ change: 點擊以選取新語言
+ description:
+ - "&7你現在可以選擇 Slimefun"
+ - "&7介面的語言"
+ - "&7不過科技物品礙於技術"
+ - "&7暫時沒有辦法翻譯"
title:
main: Slimefun指南
settings: 設置及資訊
@@ -47,7 +57,8 @@ guide:
wiki: Slimefun4 Wiki
addons: Slimefun4的附加插件
bugs: 錯誤報告
- source: 來源代碼
+ source: 原始碼
+ versions: 安裝版本
credits:
commit: 成員
commits: 成員
@@ -57,20 +68,27 @@ guide:
resourcepack: "&7資源包製作人員"
translator: "&9翻譯人員"
profile-link: 點擊觀看他們在GitHub上的個人資料
+ open: 點擊查看貢獻者
+ description:
+ - "&7Slimefun 是個開放原始碼的專案"
+ - "&7由許多人一同維護。"
+ - "&7超過 &e%contributors% &7個人在這些年中"
+ - "&7花時間開發Slimefun"
pages:
previous: 上一頁
next: 下一頁
tooltips:
open-category: 點擊開啟
- versions-notice: 這些在報告錯誤時非常重要!
+ versions-notice: 這些在回報錯誤時非常重要!
wiki: 在Slimefun官方Wiki上查看此物品
recipes:
machine: 使用本機械的合成表
miner: 此挖礦機可獲取的資源
generator: 可以使用的燃料
gold-pan: 可以獲取的資源
+ climbing-pick: 你可以攀爬的平面材質
back:
- title: 上一頁
+ title: 回上一頁
guide: 回到Slimefun指南
settings: 回到設定介面
locked: 已鎖定
@@ -78,135 +96,155 @@ guide:
- 要解鎖此分類
- 必須先解鎖下列分類
- 的所有物品
+ work-in-progress: 此功能尚未開發完成!
messages:
- not-researched: "&4你太笨了"
- not-enough-xp: "&4你沒有足夠的經驗值用以解鎖這個"
+ not-researched: "&4你還沒有足夠的知識"
+ not-enough-xp: "&4你沒有足夠的經驗值來解鎖這個"
unlocked: "&b你已解鎖&7“%research%”"
only-players: "&4此命令只可由玩家發送"
unknown-player: "&4未知玩家:&c%player%"
no-permission: "&4您沒有執行此動作所需的權限"
- usage: "&4用法: &c%usage%"
- not-online: "&4%player% &c還未上線!"
- not-valid-item: "&4%item% &c不存在!"
- not-valid-amount: "&4%amount% &c不是有效數量:數值必須大於0!"
+ usage: "&4用法:&c%usage%"
+ not-online: "&4%player% &c 還未上線!"
given-item: '&b你已獲得 &a%amount% &7"%item%&7"'
give-item: '&b你已給予%player% &a%amount% &7"%item%&7"'
- not-valid-research: "&4%research% &c不存在!"
give-research: '&b你已給予%player% 研究項目&7"%research%&7"'
hungry: "&c你太餓了,做不了這個!"
- mode-change: "&b%device% 模式切換至: &9%mode%"
disabled-in-world: "&4&l此物品在此世界中已被禁用"
- disabled-item: "&4&l此物品已被禁用!你到底是怎樣得到的?"
+ disabled-item: "&4&l此物品已被禁用!你到底是怎樣得到的?"
no-tome-yourself: "&c你不能在自己身上使用 &4知識之書&c..."
- multimeter: "&b已儲存的能量:&3%stored% &b最大容量:&3%capacity%"
+ multimeter: "&b已儲存的能量:&3%stored% &b最大容量:&3%capacity%"
talisman:
- anvil: "&a&o你的護符免了您的工具於斷裂"
+ anvil: "&a&o你的護符已避免您的工具壞掉"
miner: "&a&o你的護符剛雙倍了你的掉落"
- hunter: "&a&o你的護符剛雙倍了你的掉落"
+ hunter: "&a&o你的護符剛加倍了你的掉落物"
lava: "&a&o你的護符把你從被燒死的命運中救出"
- water: "&a&o你的護身符給了你空氣"
- angel: "&a&o你的護身符使你免疫摔落傷害"
- fire: "&a&o你的護身符使你沒有燒死"
- magician: "&a&o你的護身符給了你額外的附魔"
- traveller: "&a&o你的護身符給了你速度3"
- warrior: "&a&o你的護身符暫時提高了你的力量"
- knight: "&a&o你的護身符給了你5秒的回復時間"
- whirlwind: "&a&o你的護身符反射了投射物"
- wizard: "&a&o你的護身符為你升高了幸運等級,但也降低了其他附魔等級"
+ water: "&a&o你的護符給了你空氣"
+ angel: "&a&o你的護符使你免疫摔落傷害"
+ fire: "&a&o你的護符將你從燒死邊緣中救回"
+ magician: "&a&o你的護符給了你額外的附魔"
+ traveller: "&a&o你的護符給了你速度3"
+ warrior: "&a&o你的護符暫時提高了你的力量"
+ knight: "&a&o你的護符給了你5秒的回復時間"
+ whirlwind: "&a&o你的護符反射了投射物"
+ wizard: "&a&o你的護符為你升高了幸運等級,但也降低了其他附魔等級"
+ caveman: "&a&o你的護符給了你挖掘加速效果"
soulbound-rune:
- fail: "&c你一次只能魂綁一個物品。"
- success: "&a您已成功將此物品綁定魂綁!死後不會噴掉。"
+ fail: "&c你一次只能靈魂綁定一個物品。"
+ success: "&a您已成功將此物品綁定靈魂!死後不會掉落。"
research:
- start: "&7遠古之靈在你耳邊低語!"
+ start: "&7遠古之靈在你耳邊低語!"
progress: "&7你開始研究&b%research% &e(%progress%)"
- fire-extinguish: "&7你熄滅身上的火"
- cannot-place: "&c那裡不能放方塊!"
- no-pvp: "&c這裡不准打架!"
- radiation: "&4你正暴露在致命的輻射之下!&c立即丟棄放射性物品或裝備完整的防護服!"
+ fire-extinguish: "&7你熄滅了身上的火焰"
+ cannot-place: "&c不能在那裡放置方塊!"
+ no-pvp: "&c這裡不准打架!"
+ radiation: "&4你正暴露在致命的輻射之下!&c立即丟棄放射性物品或裝備完整的防護服!"
opening-guide: "&b正在打開指南,這可能需要幾秒鐘的時間..."
opening-backpack: "&b正在打開背包,這可能需要幾秒鐘的時間..."
- no-iron-golem-heal: "&c這不是鐵錠。你不能用它來治癒鐵巨人!"
- link-prompt: "&e點擊此處:"
+ no-iron-golem-heal: "&c這不是鐵錠。你不能用它來治癒鐵巨人!"
+ link-prompt: "&e點擊此處:"
diet-cookie: "&e你開始覺得很輕..."
fortune-cookie:
- - "&7快來幫幫我!我在幸運餅乾工廠裡出不了來!"
+ - "&7快來幫幫我!我被困在幸運餅乾工廠裡!"
- "&7明天會有苦力怕歡樂送"
- - "&7在你生命中的某個時刻,會發生一些壞事!!!"
- - "&7下周你就會注意到 這並不是現實世界 你只是在電腦遊戲之中"
+ - "&7在你生命中的某個時刻,會發生一些壞事!!!"
+ - "&7下周你就會意識到這並不是現實世界,你只是在電腦遊戲之中"
- "&7你幾秒之後就會想再吃一片"
- - '&7你死前聽到的最後一句話會是"殲滅他!!!"'
- - "&7不要擁抱苦力怕...我試過 感覺不錯 但是不值得"
- - "&742, 萬物的答案"
- - "&7Walshy會使你每天開開心心\n"
- - "&7不要垂直往下挖!"
- - "&7這只是一個小傷!"
- - "&7永遠保持樂觀積極!"
+ - "&7你死前聽到的最後一句話會是「殲滅他」!!!"
+ - "&7不要試著擁抱苦力怕...我試過,感覺還不錯,但是不值得。"
+ - "&742, 答案是 42。"
+ - "&7一天一Walshy,煩惱遠離你。\n"
+ - "&7永遠不要垂直往下挖!"
+ - "&7這只是一個小傷!"
+ - "&7永遠保持樂觀積極!"
- "&7這不是普通的餅乾"
- - "&7霓虹燈好帥!"
+ - "&7霓虹燈好帥!"
+ piglin-barter: "&4你不能用 Slimefun 物品和豬布林交易"
+ enchantment-rune:
+ fail: "&c你無法附魔該物品"
+ no-enchantment: "&c找不到可以附在該物品上的附魔。"
+ success: "&a你已成功地在該物品上附上了一個隨機的附魔"
+ tape-measure:
+ no-anchor: "&c你需要設錨點才能開始測量!"
+ wrong-world: "&c你的錨點在另外一個世界!"
+ distance: "&7測量成功 &e距離:%distance%"
+ anchor-set: "&a成功設置錨點:&e %anchor%"
+ multi-tool:
+ mode-change: "&b%device% 模式切換成:&9%mode%"
+ not-shears: "&c不要把它當剪刀用!"
+ climbing-pick:
+ dual-wielding: "&4你需要雙手都握著攀爬鎬才能攀爬!"
+ wrong-material: "&c你無法攀爬這種平面。使用你的科技指南書以獲取更多資訊!"
+ invalid-item: "&4%item% &c不存在!"
+ invalid-amount: "&4%amount% &c不是有效數量:數值必須大於 0!"
+ invalid-research: "&4%research% &c不存在!"
+ mode-change: "&b%device% 模式切換至: &9%mode%"
machines:
- pattern-not-found: "&e查無此合成表 請確認使用的機器或合成表的材料"
- unknown-material: "&e這個機器不能處理這個物品 請確認使用的機器或合成表的材料"
- wrong-item: "&e你手持的物品和機器並不相容 請確認使用的機器或合成表的材料"
- full-inventory: "&e發射器滿了!(請考慮使用基礎機械輸出箱)"
- in-use: "&c別人正在使用這台機器"
- ignition-chamber-no-flint: "&c點火系統沒有打火石"
+ pattern-not-found: "&e查無此合成表,請確認使用的機器或合成表的材料。"
+ unknown-material: "&e這個機器不能處理這個物品,請確認使用的機器或合成表的材料。"
+ wrong-item: "&e你手持的物品和機器並不相容,請確認使用的機器或合成表的材料。"
+ full-inventory: "&e發射器滿了!(請考慮使用基礎機械的輸出箱)"
+ in-use: "&c別人正在使用這台機器。"
+ ignition-chamber-no-flint: "&c點火系統沒有打火石。"
ANCIENT_ALTAR:
not-enough-pedestals: "&4此祭壇需要更多基座&c(%pedestals% / 8)"
- unknown-catalyst: "&4未知中心物品! &c請檢察合成表!"
- unknown-recipe: "&4未知合成表! &c請檢察合成表!"
+ unknown-catalyst: "&4未知中心物品! &c請檢查合成表!"
+ unknown-recipe: "&4未知合成表! &c請檢查合成表!"
ANCIENT_PEDESTAL:
- obstructed: "&4基座被擋住了! &c移除上方的方塊!"
+ obstructed: "&4基座被擋住了!&c請移除上方的方塊!"
HOLOGRAM_PROJECTOR:
- enter-text: "&7輸入你想要的文字 &r(可以輸入顏色代碼!)"
+ enter-text: "&7請輸入你想要顯示的文字訊息。 &r(可以輸入顏色代碼)"
inventory-title: 全息投影編輯器
ELEVATOR:
- no-destinations: "&4沒有目的地"
- pick-a-floor: "&3選擇樓層"
- current-floor: "&e這是你現在的樓層:"
- click-to-teleport: "&e按這 &7來傳送到該樓:"
- enter-name: "&7輸入你的樓層名稱&r(可以輸入顏色代碼!)"
- named: "&2成功命名為 &r%floor%"
+ no-destinations: "&4找不到目的地"
+ pick-a-floor: "&3- 選擇樓層 -"
+ current-floor: "&e這是你現在的樓層:"
+ click-to-teleport: "&e按這 &7來傳送到該樓層:"
+ enter-name: "&7請輸入你的樓層名稱&r(可以輸入顏色代碼)"
+ named: "&2成功命名此樓層為 :&r%floor%"
TELEPORTER:
teleporting: "&3傳送中..."
- teleported: "&3傳送成功!"
- cancelled: "&4傳送中止!"
- invulnerability: "&b&l你得到了30秒的無敵!"
+ teleported: "&3傳送成功!"
+ cancelled: "&4傳送中止!"
+ invulnerability: "&b&l你得到了30秒的無敵!"
gui:
title: 你的標記點
tooltip: 點擊以傳送
- time: 估計時間
+ time: 預計時間
CARGO_NODES:
- must-be-placed: "&4必須連接在箱子或機器旁!"
+ must-be-placed: "&4必須連接在箱子或機器側邊!"
GPS_CONTROL_PANEL:
title: GPS控制面板
transmitters: 訊號發射器總覽
waypoints: 傳送點總覽
INDUSTRIAL_MINER:
- no-fuel: "&c你的工業挖礦機沒燃料了! 將燃料放置到上方的箱子"
- piston-facing: "&c工業挖礦機的活塞需要朝上!"
- piston-space: "&c兩活塞的上面需要為空氣!"
+ no-fuel: "&c你的工業挖礦機沒燃料了!將燃料放置到上方的箱子。"
+ piston-facing: "&c工業挖礦機的活塞需要朝上!"
+ piston-space: "&c兩活塞的上面需要是空氣!"
destroyed: "&c你的工業挖礦機被摧毀了"
- already-running: "&c此工業挖礦機已經在運作中了!"
- full-chest: "&c此工業挖礦機的箱子已滿!"
- no-permission: "&4你沒有權限在此使用工業挖礦機!"
- finished: "&e你的工業挖礦機已挖掘完畢 共挖到 %ores% 個!"
+ already-running: "&c此工業挖礦機已經在運作中了!"
+ full-chest: "&c此工業挖礦機的箱子已滿!"
+ no-permission: "&4你沒有權限在此使用工業挖礦機!"
+ finished: "&e你的工業挖礦機已挖掘完畢,共挖掘 %ores% 個礦物!"
anvil:
- not-working: "&4科技物品需要用自動鐵砧+修理膠帶!"
+ not-working: "&4科技物品需要用自動鐵砧+修理膠帶!"
+ mcmmo-salvaging: "&4你不能回收利用 Slimefun 物品!"
backpack:
- already-open: "&c別人正在使用這個背包!"
- no-stack: "&c背包不能疊!"
+ already-open: "&c抱歉,這個背包正被人使用!"
+ no-stack: "&c你不能堆疊背包!"
workbench:
- not-enhanced: "&4科技物品不可在普通合成檯使用"
+ not-enhanced: "&4Slimefun 物品不可在普通工作台中使用"
gps:
deathpoint: "&4死亡點&7%date%"
waypoint:
- new: "&e輸入傳送點名稱 &7(Color Codes supported!)"
+ new: "&e請輸入傳送點名稱。 &7(可使用顏色代碼)"
added: "&a成功新增傳送點"
max: "&4傳送點已達上限"
+ duplicate: "&4已經有叫作 &f%waypoint% &4的傳送點了"
insufficient-complexity:
- - "&4GPS信號不足 &c%complexity%"
+ - "&4GPS訊號不足:&c%complexity%"
- "&4a) GPS基礎設施未放置"
- - "&4b)GPS信號不足"
+ - "&4b) GPS訊號不足"
geo:
scan-required: "&4請先做地質掃描"
inventory:
@@ -215,7 +253,7 @@ android:
started: "&7機器人繼續運作"
stopped: "&7機器人暫停運作"
scripts:
- already-uploaded: "&4程式已上傳"
+ already-uploaded: "&4程式已上傳。"
instructions:
START: "&2執行程式"
REPEAT: "&9重複程式"
@@ -245,16 +283,16 @@ android:
INTERFACE_FUEL: "&c從燃料節點取得燃料"
enter-name:
-
- - "&e輸入程式名稱"
+ - "&e請輸入程式名稱"
uploaded:
- - "&b上傳中"
- - "&a成功上傳程式!"
+ - "&b上傳中..."
+ - "&a成功上傳程式!"
rating:
- own: "&4你不能評價自己的程式!"
- already: "&4你已經評價過此程式!"
+ own: "&4你不能評價自己的程式!"
+ already: "&4你已經評價過此程式!"
editor: 程式編輯器
languages:
- default: 默認
+ default: 預設
en: 英語
de: 德語
fr: 法文
@@ -268,24 +306,24 @@ languages:
lv: 拉脫維亞語
ru: 俄語
sk: 斯洛伐克文
- zh-TW: 中文(繁體)
+ zh-TW: 中文(正體)
vi: 越南文
id: 印尼語
zh-CN: 中文(簡體)
el: 希臘語
he: 希伯來語
+ pt: 葡萄牙文(葡萄牙)
ar: 阿拉伯文
af: 南非語
da: 丹麥文
fi: 芬蘭文
uk: 烏克蘭文
ms: 馬來語
- 'no': 挪威
+ 'no': 挪威語
ja: 日語
fa: 波斯語
th: 泰語
ro: 羅馬尼亞語
- pt: 葡萄牙文(葡萄牙)
pt-BR: 葡萄牙文(巴西)
bg: 保加利亞語
ko: 韓語
@@ -295,5 +333,13 @@ languages:
sr: 塞爾維亞語
be: 白俄羅斯語
tl: 他加祿語
+brewing_stand:
+ not-working: "&4你不能用 Slimefun 物品釀造!"
+villagers:
+ no-trading: "&4你不能用 Slimefun 物品交易!"
+cartography_table:
+ not-working: "&4你不能在製圖桌上使用 Slimefun 物品!"
+cauldron:
+ no-discoloring: "&4你不能把 Slimefun 裝備的顏色消除!"
miner:
no-ores: "&e附近沒礦了!"
diff --git a/src/main/resources/languages/recipes_ko.yml b/src/main/resources/languages/recipes_ko.yml
index dcf9daa0c..8fbaa0b79 100644
--- a/src/main/resources/languages/recipes_ko.yml
+++ b/src/main/resources/languages/recipes_ko.yml
@@ -6,109 +6,109 @@ slimefun:
- 표시된 구조를 설치
- 보여진 바와 같이. 제작되지 않습니다.
enhanced_crafting_table:
+ name: '향상된 조합대 (Enhanced Crafting Table)'
lore:
- 표시된대로 이 아이템을 제작하십시오
- 향상된 조합대(Enhanced Crafting Table) 내에서
- 일반 조합대로는 충분하지 않습니다!
- name: '향상된 조합대 (Enhanced Crafting Table) '
armor_forge:
+ name: 갑옷 대장간 (Armor Forge)
lore:
- 표시된대로 이 아이템을 제작하십시오
- 갑옷 대장간 (Armor Forge) 사용
- name: 갑옷 대장간 (Armor Forge
grind_stone:
+ name: 맷돌 (Grind Stone)
lore:
- 표시된대로이 아이템을 제작하십시오
- 맷돌(Grind Stone) 사용
- name: 맷돌 (Grind Stone)
smeltery:
+ name: 제련소 (Smeltery)
lore:
- 표시된대로 이 아이템을 제작하십시오
- 제련소 (Smeltery) 사용
- name: 제련소 (Smeltery)
ore_crusher:
+ name: 광석 분쇄기 (Ore Crusher)
lore:
- 표시된대로이 아이템을 제작하십시오
- 광석 분쇄기 (Ore Crusher) 사용
- name: 광석 분쇄기 (Ore Crusher)
mob_drop:
name: 몹 드롭
lore:
- 몹을 처치하여
- 이 아이템을 얻다
gold_pan:
+ name: 골드 판 (Gold Pan)
lore:
- 골드 판 (Gold Pan) 사용
- 이 아이템을 얻다
- name: 골드 판 (Gold Pan)
compressor:
+ name: 압축기 (Compressor)
lore:
- 표시된대로 이 아이템을 제작하십시오
- 압축기(Compressor) 를 사용하여
- name: 압축기 (Compressor)
pressure_chamber:
name: 압력 챔버
lore:
- 표시된대로이 아이템을 제작하십시오
- 압력 챔버를 사용하여
ore_washer:
+ name: 광물 세척기 (Ore Washer)
lore:
- 표시된대로 이 아이템을 제작하십시오
- 광물 세척기를 사용하여
- name: 광물 세척기 (Ore Washer)
juicer:
+ name: 주스기 (Juicer)
lore:
- 그림과 같이 주스를 만드십시오
- 주스기 (Juicer) 를 사용하여
- name: 주스기 (Juicer)
magic_workbench:
+ name: 마법 조합대 (Magic Workbench)
lore:
- 표시된대로 이 아이템을 제작하십시오
- 마법 조합대 (Magic Workbench) 를 사용하여
- name: 마법 조합대 (Magic Workbench)
ancient_altar:
+ name: 고대 제단 (Ancient Altar)
lore:
- 표시된대로 이 아이템을 제작하십시오
- 고대 제단 (Ancient Altar) 을 사용하여
- 자세한 정보는 고대 제단 (Ancient Altar) 을 찾아보십시오
- name: 고대 제단 (Ancient Altar)
heated_pressure_chamber:
+ name: 가열 압력 챔버 (Heated Pressure Chamber)
lore:
- 표시된대로 이 아이템을 제작하십시오
- 가열 압력 챔버 (Heated Pressure Chamber) 를 사용하여
- name: 가열 압력 챔버 (Heated Pressure Chamber)
food_fabricator:
+ name: 식품 제작기 (Food Fabricator)
lore:
- 표시된대로 이 아이템을 제작하십시오
- 식품 제작기 (Food Fabricator) 를 사용하여
- name: 식품 제작기 (Food Fabricator)
food_composter:
+ name: 식품 퇴비통 (Food Composter)
lore:
- 표시된대로 이 아이템을 제작하십시오
- 식품 퇴비통 (Food Composter) 을 사용하여
- name: 식품 퇴비통 (Food Composter)
freezer:
+ name: 냉동고 (Freezer)
lore:
- 표시된대로 이 아이템을 제작하십시오
- 냉동고 (Freezer) 를 사용하여
- name: 냉동고 (Freezer)
geo_miner:
+ name: GEO 마이너 (GEO Miner)
lore:
- 채굴 할 수있는 아이템
- GEO 마이너 (Geo Miner) 를 사용하여
- name: GEO 마이너 (GEO Miner)
nuclear_reactor:
+ name: 원자로 (Nuclear Reactor)
lore:
- 이 아이템은 부산물입니다
- 원자로 (Nuclear Reactor) 운영
- name: 원자로 (Nuclear Reactor)
oil_pump:
name: 오일 펌프 (Oil Pump)
lore:
- 이 아이템은 수집 가능합니다.
- 오일 펌프 (Oil Pump) 를 사용하여
pickaxe_of_containment:
- name: 억제의 곡괭이
+ name: 억제의 곡괭이 (Pickaxe of Containment)
lore:
- 이 블록을 얻을 수 있습니다
- 를 통해 스포너를 채굴하여
@@ -118,19 +118,24 @@ slimefun:
lore:
- 표시된대로이 아이템을 제작하십시오
- 정유 공장 (Refinery) 을 사용하여
+ barter_drop:
+ name: 피글린 물물 교환 드롭
+ lore:
+ - 다음을 사용하여 피글린과 물물 교환
+ - 이 아이템을 얻기위한 금괴
minecraft:
shaped:
+ name: 유형 조합 조합법
lore:
- 표시된대로 이 아이템을 제작하십시오
- 일반 조합대에서
- 모양이 중요합니다.
- name: 유형 조합 조합법
shapeless:
+ name: 무형 조합 조합법
lore:
- 표시된대로 이 아이템을 제작하십시오
- 일반 조합대에서
- 이 조합법은 형태가 없습니다.
- name: 무형 조합 조합법
furnace:
name: 화로 조합법
lore:
@@ -156,3 +161,8 @@ minecraft:
lore:
- 표시된대로이 아이템을 제작하십시오
- 석제 절단기를 사용하여
+ smithing:
+ name: 스미팅 테이블 레시피
+ lore:
+ - 표시된대로 이 아이템을 제작하십시오
+ - 스미팅 테이블 사용
diff --git a/src/main/resources/languages/recipes_zh-TW.yml b/src/main/resources/languages/recipes_zh-TW.yml
index 52f547443..22108a6c6 100644
--- a/src/main/resources/languages/recipes_zh-TW.yml
+++ b/src/main/resources/languages/recipes_zh-TW.yml
@@ -122,6 +122,11 @@ slimefun:
lore:
- 使用煉油廠
- 提煉該物品
+ barter_drop:
+ name: 豬布林交易
+ lore:
+ - 用黃金和豬布林
+ - 交易以獲取此物品
minecraft:
shaped:
name: 有序合成
diff --git a/src/main/resources/languages/researches_hu.yml b/src/main/resources/languages/researches_hu.yml
index 2715e2184..f1bf8cedc 100644
--- a/src/main/resources/languages/researches_hu.yml
+++ b/src/main/resources/languages/researches_hu.yml
@@ -246,3 +246,4 @@ slimefun:
caveman_talisman: Az Ősember talizmánja
even_higher_tier_capacitors: 3. szintű kondenzátorok
elytra_cap: Ütközésvédelem
+ energy_connectors: Vezetékes csatlakozás
diff --git a/src/main/resources/languages/researches_zh-CN.yml b/src/main/resources/languages/researches_zh-CN.yml
index b0db0509e..3b2187c3a 100644
--- a/src/main/resources/languages/researches_zh-CN.yml
+++ b/src/main/resources/languages/researches_zh-CN.yml
@@ -243,3 +243,6 @@ slimefun:
climbing_pick: 古块丽影
shulker_shell: 人造潜影贝
villager_rune: 防奸商神器
+ caveman_talisman: 穴居人护身符
+ even_higher_tier_capacitors: 三级电容器
+ energy_connectors: 有线连接
diff --git a/src/main/resources/languages/researches_zh-TW.yml b/src/main/resources/languages/researches_zh-TW.yml
index 209e0dbbf..caf477469 100644
--- a/src/main/resources/languages/researches_zh-TW.yml
+++ b/src/main/resources/languages/researches_zh-TW.yml
@@ -46,7 +46,7 @@ slimefun:
damascus_steel_armor: 大馬士革鋼套裝
reinforced_alloy: 強化合金錠
carbonado: 黑鑽石
- magic_workbench: 魔術合成檯
+ magic_workbench: 魔法合成檯
wind_staff: 元素杖—風
reinforced_armor: 強化合金錠套裝
ore_washer: 礦物洗滌機
@@ -93,7 +93,7 @@ slimefun:
explosive_tools: 爆炸性的突破
automated_panning_machine: 懶人掏金盤
boots_of_the_stomper: 踐踏之靴
- pickaxe_of_the_seeker: 合法X-ray
+ pickaxe_of_the_seeker: 合法 X-ray
backpacks: 背包
woven_backpack: 手織背包
crucible: 坩鍋
@@ -150,12 +150,12 @@ slimefun:
electric_ore_grinding: 電動研磨
heated_pressure_chamber: 高溫加壓室
coal_generator: 乾淨的煤
- bio_reactor: 生化反應爐
+ bio_reactor: 生質能反應爐
auto_enchanting: 附魔&退魔檯
auto_anvil: 電動鐵砧
multimeter: 電力測量
- gps_setup: GPS基礎組件
- gps_emergency_transmitter: GPS求救信號
+ gps_setup: GPS 基礎組件
+ gps_emergency_transmitter: GPS 求救信號
programmable_androids: 機器人
android_interfaces: 機器人接口
geo_scanner: 地質掃描
@@ -166,19 +166,19 @@ slimefun:
better_gps_transmitters: 高階GPS信號發送器
elevator: 電梯
energized_solar_generator: 這...這不科學!
- energized_gps_transmitter: 頂級GPS信號發送器
+ energized_gps_transmitter: 頂級 GPS 信號發送器
energy_regulator: 電力核心
butcher_androids: 屠夫機器人
organic_food: 有機食品
auto_breeder: 幫你餵動物
advanced_android: 進階機器人
- advanced_butcher_android: 進階機器人–屠夫
- advanced_fisherman_android: 進階機器人— 漁夫
+ advanced_butcher_android: 進階機器人—屠夫
+ advanced_fisherman_android: 進階機器人—漁夫
animal_growth_accelerator: 動物轉大人
xp_collector: 經驗收集器
organic_fertilizer: 有機堆肥
crop_growth_accelerator: 金坷垃
- better_crop_growth_accelerator: 金坷垃2.0
+ better_crop_growth_accelerator: 金坷垃 2.0
reactor_essentials: 反應爐必需品
nuclear_reactor: 核分裂反應爐
freezer: 我的超人裝呢
@@ -199,7 +199,7 @@ slimefun:
better_electric_furnace: 升級版電磁爐
better_carbon_press: 升級版碳壓縮機
empowered_android: 頂級機器人
- empowered_butcher_android: 頂級機器人-屠夫
+ empowered_butcher_android: 頂級機器人—屠夫
empowered_fisherman_android: 頂級機器人—漁夫
high_tier_carbon_press: 終極碳壓縮機
wither_assembler: 凋零農場
@@ -233,10 +233,17 @@ slimefun:
makeshift_smeltery: 自動冶煉
tree_growth_accelerator: 自動金坷垃
industrial_miner: 工業化採礦
- advanced_industrial_miner: 工業化採礦 - 改
+ advanced_industrial_miner: 工業化採礦—改
magical_zombie_pills: 救贖藥丸
auto_brewer: 工業化釀造
enchantment_rune: 古代附魔
lead_clothing: 防輻射衣
tape_measure: 捲尺
iron_golem_assembler: 鐵巨人召喚機
+ climbing_pick: 飛簷走壁
+ shulker_shell: 工業界伏殼
+ villager_rune: 讓村民失業
+ caveman_talisman: 穴居人護符
+ even_higher_tier_capacitors: 第三級電容器
+ elytra_cap: 體驗動能
+ energy_connectors: 電線
diff --git a/src/main/resources/languages/resources_zh-TW.yml b/src/main/resources/languages/resources_zh-TW.yml
index dd6739964..299b19382 100644
--- a/src/main/resources/languages/resources_zh-TW.yml
+++ b/src/main/resources/languages/resources_zh-TW.yml
@@ -14,11 +14,11 @@ resources:
slimefunorechunks:
iron_ore_chunk: 鐵石塊
gold_ore_chunk: 金石塊
- copper_ore_chunk: 銅礦塊
- tin_ore_chunk: 錫礦塊
+ copper_ore_chunk: 銅石塊
+ tin_ore_chunk: 錫石塊
silver_ore_chunk: 銀石塊
aluminum_ore_chunk: 鋁石塊
lead_ore_chunk: 鉛石塊
- zinc_ore_chunk: 鋅礦塊
- nickel_ore_chunk: 鎳礦塊
+ zinc_ore_chunk: 鋅石塊
+ nickel_ore_chunk: 鎳石塊
cobalt_ore_chunk: 鈷石塊
diff --git a/src/main/resources/tags/block_placer_ignored_materials.json b/src/main/resources/tags/block_placer_ignored_materials.json
index 84091d9f9..0e84d9d81 100644
--- a/src/main/resources/tags/block_placer_ignored_materials.json
+++ b/src/main/resources/tags/block_placer_ignored_materials.json
@@ -1,16 +1,62 @@
{
"values" : [
"#slimefun:sensitive_materials",
+ "#slimefun:tall_flowers",
"#slimefun:mushrooms",
"#minecraft:beds",
+ "#minecraft:buttons",
+ "#minecraft:signs",
"#minecraft:doors",
+ "#minecraft:rails",
+ "#minecraft:small_flowers",
+ "#minecraft:coral_blocks",
+ "#minecraft:corals",
+ "#minecraft:carpets",
+ "#minecraft:banners",
"minecraft:sugar_cane",
- "minecraft:bamboo",
"minecraft:cactus",
+ "minecraft:bamboo",
+ "minecraft:vine",
+ "minecraft:ladder",
+ "minecraft:chorus_plant",
+ "minecraft:chorus_flower",
+ "minecraft:snow",
+ "minecraft:lever",
+ "minecraft:repeater",
+ "minecraft:tripwire_hook",
"minecraft:lily_pad",
"minecraft:dead_bush",
+ "minecraft:fern",
+ "minecraft:grass",
+ "minecraft:sea_pickle",
+ "minecraft:nether_wart",
+ "minecraft:seagrass",
+ "minecraft:tall_seagrass",
+ "minecraft:kelp",
+ "minecraft:bell",
+ "minecraft:lantern",
{
- "id" : "#minecraft:tall_flowers",
+ "id" : "minecraft:soul_lantern",
+ "required" : false
+ },
+ {
+ "id" : "minecraft:nether_sprouts",
+ "required" : false
+ },
+ {
+ "id" : "minecraft:crimson_roots",
+ "required": false
+ },
+ {
+ "id" : "minecraft:twisting_vines",
+ "required" : false
+ },
+ {
+ "id" : "minecraft:warped_roots",
+ "required" : false
+ },
+ {
+ "id" : "minecraft:weeping_vines",
"required" : false
}
]
diff --git a/src/main/resources/tags/pressure_plates.json b/src/main/resources/tags/pressure_plates.json
new file mode 100644
index 000000000..b8bdb7667
--- /dev/null
+++ b/src/main/resources/tags/pressure_plates.json
@@ -0,0 +1,12 @@
+{
+ "values" : [
+ "#minecraft:wooden_pressure_plates",
+ "minecraft:stone_pressure_plate",
+ "minecraft:light_weighted_pressure_plate",
+ "minecraft:heavy_weighted_pressure_plate",
+ {
+ "id" : "minecraft:polished_blackstone_pressure_plate",
+ "required" : false
+ }
+ ]
+}
diff --git a/src/main/resources/tags/sensitive_materials.json b/src/main/resources/tags/sensitive_materials.json
index bd782e1e6..daae5c94f 100644
--- a/src/main/resources/tags/sensitive_materials.json
+++ b/src/main/resources/tags/sensitive_materials.json
@@ -1,11 +1,8 @@
{
"values" : [
"#minecraft:saplings",
- "#minecraft:wooden_pressure_plates",
"#slimefun:torches",
- "minecraft:stone_pressure_plate",
- "minecraft:light_weighted_pressure_plate",
- "minecraft:heavy_weighted_pressure_plate",
+ "#slimefun:pressure_plates",
"minecraft:cake"
]
}
diff --git a/src/main/resources/tags/smelters_pickaxe_blocks.json b/src/main/resources/tags/smelters_pickaxe_blocks.json
index 79444a5aa..da26b5634 100644
--- a/src/main/resources/tags/smelters_pickaxe_blocks.json
+++ b/src/main/resources/tags/smelters_pickaxe_blocks.json
@@ -5,6 +5,10 @@
"required" : false
},
"minecraft:gold_ore",
- "minecraft:iron_ore"
+ "minecraft:iron_ore",
+ {
+ "id" : "minecraft:ancient_debris",
+ "required" : false
+ }
]
}
diff --git a/src/main/resources/tags/tall_flowers.json b/src/main/resources/tags/tall_flowers.json
new file mode 100644
index 000000000..61958b5de
--- /dev/null
+++ b/src/main/resources/tags/tall_flowers.json
@@ -0,0 +1,10 @@
+{
+ "values" : [
+ "minecraft:lilac",
+ "minecraft:rose_bush",
+ "minecraft:peony",
+ "minecraft:tall_grass",
+ "minecraft:large_fern",
+ "minecraft:sunflower"
+ ]
+}
diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/listeners/TestCoolerListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/listeners/TestCoolerListener.java
index e3dd6b8e7..fe95c167b 100644
--- a/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/listeners/TestCoolerListener.java
+++ b/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/listeners/TestCoolerListener.java
@@ -17,6 +17,7 @@ import org.junit.jupiter.api.Test;
import be.seeseemelk.mockbukkit.MockBukkit;
import be.seeseemelk.mockbukkit.ServerMock;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
+import io.github.thebusybiscuit.slimefun4.api.events.CoolerFeedPlayerEvent;
import io.github.thebusybiscuit.slimefun4.api.player.PlayerBackpack;
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
@@ -81,6 +82,8 @@ class TestCoolerListener {
FoodLevelChangeEvent event = new FoodLevelChangeEvent(player, 16);
listener.onHungerLoss(event);
+
Assertions.assertTrue(player.hasPotionEffect(PotionEffectType.HEALTH_BOOST));
+ server.getPluginManager().assertEventFired(CoolerFeedPlayerEvent.class, e -> e.getPlayer() == player && e.getCooler() == cooler);
}
}
diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/listeners/TestNetworkListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/listeners/TestNetworkListener.java
index 9506c80af..4e8e1b24e 100644
--- a/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/listeners/TestNetworkListener.java
+++ b/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/listeners/TestNetworkListener.java
@@ -25,7 +25,7 @@ class TestNetworkListener {
private static SlimefunPlugin plugin;
private static NetworkListener listener;
- private static NetworkManager manager = new NetworkManager(80);
+ private static NetworkManager manager = new NetworkManager(80, false);
private static ServerMock server;
@BeforeAll
diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/networks/TestNetworkManager.java b/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/networks/TestNetworkManager.java
index f0d043d46..4aec2a175 100644
--- a/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/networks/TestNetworkManager.java
+++ b/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/networks/TestNetworkManager.java
@@ -37,15 +37,15 @@ class TestNetworkManager {
@Test
@DisplayName("Test illegal network size arguments")
void testIllegalNetworkSize() {
- Assertions.assertThrows(IllegalArgumentException.class, () -> new NetworkManager(-100));
- Assertions.assertThrows(IllegalArgumentException.class, () -> new NetworkManager(0));
+ Assertions.assertThrows(IllegalArgumentException.class, () -> new NetworkManager(-100, false));
+ Assertions.assertThrows(IllegalArgumentException.class, () -> new NetworkManager(0, false));
}
@Test
@DisplayName("Test maximum network size")
void testGetMaxNetworkSize() {
int size = 50;
- NetworkManager manager = new NetworkManager(size);
+ NetworkManager manager = new NetworkManager(size, false);
Assertions.assertEquals(size, manager.getMaxSize());
}
@@ -53,7 +53,7 @@ class TestNetworkManager {
@Test
@DisplayName("Test network list")
void testGetNetworkList() {
- NetworkManager manager = new NetworkManager(10);
+ NetworkManager manager = new NetworkManager(10, false);
World world = server.addSimpleWorld("Simple Network World");
Location loc = new Location(world, 0, 100, 0);
@@ -82,7 +82,7 @@ class TestNetworkManager {
@Test
@DisplayName("Test getting a network at a location")
void testGetNetworkAtLocation() {
- NetworkManager manager = new NetworkManager(10);
+ NetworkManager manager = new NetworkManager(10, false);
World world = server.addSimpleWorld("Simple Network World");
Location loc = new Location(world, 0, 100, 0);
Location loc2 = new Location(world, 0, 200, 0);
@@ -104,7 +104,7 @@ class TestNetworkManager {
@Test
@DisplayName("Test getting all networks at a location")
void testGetNetworksAtLocation() {
- NetworkManager manager = new NetworkManager(10);
+ NetworkManager manager = new NetworkManager(10, false);
World world = server.addSimpleWorld("Simple Network World");
Location loc = new Location(world, 0, 100, 0);
Location loc2 = new Location(world, 0, 200, 0);
@@ -120,7 +120,7 @@ class TestNetworkManager {
@Test
@DisplayName("Test a single node network")
void testSingleNodeNetwork() {
- NetworkManager manager = new NetworkManager(1);
+ NetworkManager manager = new NetworkManager(1, false);
World world = server.addSimpleWorld("Simple Network World");
Location loc = new Location(world, 0, 100, 0);
@@ -134,7 +134,7 @@ class TestNetworkManager {
@Test
@DisplayName("Test networks connecting via corners")
void testCornerConnection() {
- NetworkManager manager = new NetworkManager(100);
+ NetworkManager manager = new NetworkManager(100, false);
World world = server.addSimpleWorld("Simple Network World");
Map map = new HashMap<>();
diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/registration/TestItemSetup.java b/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/registration/TestItemSetup.java
index ae0589208..9af935b77 100644
--- a/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/registration/TestItemSetup.java
+++ b/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/registration/TestItemSetup.java
@@ -17,10 +17,12 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import be.seeseemelk.mockbukkit.MockBukkit;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemState;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.setup.PostSetup;
import io.github.thebusybiscuit.slimefun4.implementation.setup.SlimefunItemSetup;
import me.mrCookieSlime.Slimefun.Objects.Category;
+import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
@TestMethodOrder(value = OrderAnnotation.class)
class TestItemSetup {
@@ -53,13 +55,22 @@ class TestItemSetup {
@Test
@Order(value = 2)
+ @DisplayName("Assert all Items enabled")
+ void testNoDisabledItems() {
+ for (SlimefunItem item : SlimefunPlugin.getRegistry().getAllSlimefunItems()) {
+ Assertions.assertNotEquals(ItemState.UNREGISTERED, item.getState(), item.toString() + " was not registered?");
+ }
+ }
+
+ @Test
+ @Order(value = 3)
@DisplayName("Test whether PostSetup.setupWiki() throws any Exceptions")
void testWikiSetup() {
Assertions.assertDoesNotThrow(() -> PostSetup.setupWiki());
}
@Test
- @Order(value = 3)
+ @Order(value = 4)
@DisplayName("Test whether every Category is added to the translation files")
void testCategoryTranslations() throws IOException {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/languages/categories_en.yml"), StandardCharsets.UTF_8))) {
diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/researches/TestResearches.java b/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/researches/TestResearches.java
index ce3ff70ef..9c6dd4b21 100644
--- a/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/researches/TestResearches.java
+++ b/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/researches/TestResearches.java
@@ -2,6 +2,9 @@ package io.github.thebusybiscuit.slimefun4.testing.tests.researches;
import java.util.Optional;
+import io.github.thebusybiscuit.slimefun4.api.events.PlayerPreResearchEvent;
+import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
+import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideImplementation;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
@@ -19,6 +22,7 @@ import io.github.thebusybiscuit.slimefun4.core.researching.Research;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.testing.TestUtilities;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import org.mockito.Mockito;
class TestResearches {
@@ -182,4 +186,29 @@ class TestResearches {
Assertions.assertTrue(research.canUnlock(player));
}
+ @Test
+ @DisplayName("Test PlayerPreResearchEvent")
+ void testPreCanUnlockResearchEvent() throws InterruptedException {
+ SlimefunPlugin.getRegistry().setResearchingEnabled(true);
+
+ NamespacedKey key = new NamespacedKey(plugin, "simple_research");
+ Research research = new Research(key, 250, "Test", 10);
+ research.register();
+
+ SlimefunGuideImplementation guide = Mockito.mock(SlimefunGuideImplementation.class);
+ Player player = server.addPlayer();
+ PlayerProfile profile = TestUtilities.awaitProfile(player);
+ SlimefunItem sfItem = TestUtilities.mockSlimefunItem(plugin, "RESEARCH_TEST", new CustomItem(Material.TORCH, "&bResearch Test"));
+
+ research.unlockFromGuide(guide, player, profile, sfItem, sfItem.getCategory(), 0);
+
+ server.getPluginManager().assertEventFired(PlayerPreResearchEvent.class, event -> {
+ Assertions.assertEquals(player, event.getPlayer());
+ Assertions.assertEquals(research, event.getResearch());
+ Assertions.assertEquals(sfItem, event.getSlimefunItem());
+ Assertions.assertFalse(event.isCancelled());
+ return true;
+ });
+ }
+
}
diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/tags/TestSlimefunTags.java b/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/tags/TestSlimefunTags.java
index 7c2a6f51f..139c5c998 100644
--- a/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/tags/TestSlimefunTags.java
+++ b/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/tags/TestSlimefunTags.java
@@ -63,6 +63,7 @@ class TestSlimefunTags {
// Inclusion through a Slimefun Tag
Assertions.assertTrue(SlimefunTag.SENSITIVE_MATERIALS.isTagged(Material.TORCH));
+ Assertions.assertTrue(SlimefunTag.SENSITIVE_MATERIALS.isTagged(Material.OAK_PRESSURE_PLATE));
}
@Test
diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/utils/TestNumberUtils.java b/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/utils/TestNumberUtils.java
new file mode 100644
index 000000000..6b33de558
--- /dev/null
+++ b/src/test/java/io/github/thebusybiscuit/slimefun4/testing/tests/utils/TestNumberUtils.java
@@ -0,0 +1,78 @@
+package io.github.thebusybiscuit.slimefun4.testing.tests.utils;
+
+import java.time.LocalDateTime;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+
+import io.github.thebusybiscuit.slimefun4.utils.NumberUtils;
+
+class TestNumberUtils {
+
+ @Test
+ @DisplayName("Test NumberUtils.clamp(...)")
+ void testHumanize() {
+ // Below minimum
+ Assertions.assertEquals(2, NumberUtils.clamp(2, 0, 5));
+
+ // Normal
+ Assertions.assertEquals(3, NumberUtils.clamp(0, 3, 5));
+
+ // Above maximum
+ Assertions.assertEquals(20, NumberUtils.clamp(1, 100, 20));
+ }
+
+ @Test
+ @DisplayName("Test elapsed time string")
+ void testElapsedTime() {
+ LocalDateTime start = LocalDateTime.now();
+
+ LocalDateTime a = start.plusDays(1);
+ Assertions.assertEquals("1d", NumberUtils.getElapsedTime(start, a));
+
+ LocalDateTime b = start.plusHours(25);
+ Assertions.assertEquals("1d 1h", NumberUtils.getElapsedTime(start, b));
+
+ LocalDateTime c = start.plusHours(1);
+ Assertions.assertEquals("1h", NumberUtils.getElapsedTime(start, c));
+
+ LocalDateTime d = start.plusMinutes(12);
+ Assertions.assertEquals("< 1h", NumberUtils.getElapsedTime(start, d));
+ }
+
+ @Test
+ @DisplayName("Test Integer parsing")
+ void testIntegerParsing() {
+ Assertions.assertEquals(6, NumberUtils.getInt("6", 0));
+ Assertions.assertEquals(12, NumberUtils.getInt("I am a String", 12));
+ }
+
+ @Test
+ @DisplayName("Test nullable Long")
+ void testNullableLong() {
+ Assertions.assertEquals(10, NumberUtils.getLong(10L, 20L));
+ Assertions.assertEquals(20, NumberUtils.getLong(null, 20L));
+ }
+
+ @Test
+ @DisplayName("Test nullable Int")
+ void testNullableInt() {
+ Assertions.assertEquals(10, NumberUtils.getInt(10, 20));
+ Assertions.assertEquals(20, NumberUtils.getInt((Integer) null, 20));
+ }
+
+ @Test
+ @DisplayName("Test nullable Float")
+ void testNullableFloat() {
+ Assertions.assertEquals(10, NumberUtils.getFloat(10F, 20F));
+ Assertions.assertEquals(20, NumberUtils.getFloat(null, 20F));
+ }
+
+ @Test
+ @DisplayName("Test decimal rounding")
+ void testRounding() {
+ Assertions.assertEquals("5.25", NumberUtils.roundDecimalNumber(5.249999999999));
+ }
+
+}