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

Merge branch 'master' into refactoring/block-energy

This commit is contained in:
TheBusyBiscuit 2020-08-24 02:11:59 +02:00 committed by GitHub
commit d998f3ec8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
58 changed files with 738 additions and 873 deletions

View File

@ -44,6 +44,12 @@
* Small performance improvements for Slimefun guides
* Small performance improvements for Cargo networks
* Small performance improvements for Miner Androids
* Small performance improvements for all machines, especially Electric Smelteries
* Small performance improvements for Holograms
* Small performance improvements for Tree Growth Accelerators
* Small performance improvements for Reactors
* Electric machines now show their tier in the Inventory name too
* Removed "Fuel efficiency" attribute for androids, since that was pretty much always at 1.0 anyway...
#### Fixes
* Fixed Programmable Androids rotating in the wrong direction
@ -70,6 +76,9 @@
* Fixed ChestTerminal timings showing up as cargo nodes
* Fixed timings reports never arriving sometimes
* Fixed #2138
* Fixed #1951 (again)
* Fixed Electric Press not working
* Fixed #2240
## Release Candidate 15 (01 Aug 2020)

View File

@ -320,7 +320,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.5.2</version>
<version>3.5.5</version>
<scope>test</scope>
</dependency>
@ -340,7 +340,7 @@
<dependency>
<groupId>com.konghq</groupId>
<artifactId>unirest-java</artifactId>
<version>3.9.00</version>
<version>3.10.00</version>
<exclusions>
<exclusion>
<groupId>com.google.code.gson</groupId>

View File

@ -19,6 +19,7 @@ import org.bukkit.plugin.Plugin;
import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetProvider;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.papermc.lib.PaperLib;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.Objects.handlers.BlockTicker;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
@ -34,26 +35,108 @@ import me.mrCookieSlime.Slimefun.api.Slimefun;
* @author TheBusyBiscuit
*
*/
public class ErrorReport {
public class ErrorReport<T extends Throwable> {
private static final DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd-HH-mm", Locale.ROOT);
private static int count;
private SlimefunAddon addon;
private T throwable;
private File file;
public ErrorReport(Throwable throwable, SlimefunAddon addon, Consumer<PrintStream> printer) {
Slimefun.runSync(() -> {
file = getNewFile();
public ErrorReport(T throwable, SlimefunAddon addon, Consumer<PrintStream> printer) {
this.throwable = throwable;
this.addon = addon;
Slimefun.runSync(() -> print(printer));
}
public ErrorReport(T throwable, Location l, SlimefunItem item) {
this(throwable, item.getAddon(), stream -> {
stream.println("Block Info:");
stream.println(" World: " + l.getWorld().getName());
stream.println(" X: " + l.getBlockX());
stream.println(" Y: " + l.getBlockY());
stream.println(" Z: " + l.getBlockZ());
stream.println(" Material: " + l.getBlock().getType());
stream.println(" Block Data: " + l.getBlock().getBlockData().getClass().getName());
stream.println(" State: " + l.getBlock().getState().getClass().getName());
stream.println();
if (item.getBlockTicker() != null) {
stream.println("Ticker-Info:");
stream.println(" Type: " + (item.getBlockTicker().isSynchronized() ? "Synchronized" : "Asynchronous"));
stream.println();
}
if (item instanceof EnergyNetProvider) {
stream.println("Ticker-Info:");
stream.println(" Type: Indirect (Energy Network)");
stream.println();
}
stream.println("Slimefun Data:");
stream.println(" ID: " + item.getID());
stream.println(" Inventory: " + BlockStorage.getStorage(l.getWorld()).hasInventory(l));
stream.println(" Data: " + BlockStorage.getBlockInfoAsJson(l));
stream.println();
});
}
public ErrorReport(T throwable, SlimefunItem item) {
this(throwable, item.getAddon(), stream -> {
stream.println("SlimefunItem:");
stream.println(" ID: " + item.getID());
stream.println(" Plugin: " + (item.getAddon() == null ? "Unknown" : item.getAddon().getName()));
stream.println();
});
}
/**
* This method returns the {@link File} this {@link ErrorReport} has been written to.
*
* @return The {@link File} for this {@link ErrorReport}
*/
public File getFile() {
return file;
}
/**
* This returns the {@link Throwable} that was thrown.
*
* @return The {@link Throwable}
*/
public T getThrown() {
return throwable;
}
/**
* This method returns the amount of {@link ErrorReport ErrorReports} created in this session.
*
* @return The amount of {@link ErrorReport ErrorReports} created.
*/
public static int count() {
return count;
}
private void print(Consumer<PrintStream> printer) {
this.file = getNewFile();
count++;
try (PrintStream stream = new PrintStream(file, StandardCharsets.UTF_8.name())) {
stream.println();
stream.println("Java Environment:");
stream.println(" Operating System: " + System.getProperty("os.name"));
stream.println(" Java Version: " + System.getProperty("java.version"));
stream.println();
stream.println("Server Software: " + Bukkit.getName());
String serverSoftware = PaperLib.isSpigot() && !PaperLib.isPaper() ? "Spigot" : Bukkit.getName();
stream.println("Server Software: " + serverSoftware);
stream.println(" Build: " + Bukkit.getVersion());
stream.println(" Minecraft: " + Bukkit.getBukkitVersion());
stream.println(" Minecraft v" + Bukkit.getBukkitVersion());
stream.println();
stream.println("Slimefun Environment:");
stream.println(" CS-CoreLib v" + SlimefunPlugin.getCSCoreLibVersion());
stream.println(" Slimefun v" + SlimefunPlugin.getVersion());
@ -95,48 +178,6 @@ public class ErrorReport {
catch (Exception x) {
addon.getLogger().log(Level.SEVERE, x, () -> "An Error occurred while saving an Error-Report for Slimefun " + SlimefunPlugin.getVersion());
}
});
}
public ErrorReport(Throwable throwable, Location l, SlimefunItem item) {
this(throwable, item.getAddon(), stream -> {
stream.println("Block Info:");
stream.println(" World: " + l.getWorld().getName());
stream.println(" X: " + l.getBlockX());
stream.println(" Y: " + l.getBlockY());
stream.println(" Z: " + l.getBlockZ());
stream.println(" Material: " + l.getBlock().getType());
stream.println(" Block Data: " + l.getBlock().getBlockData().getClass().getName());
stream.println(" State: " + l.getBlock().getState().getClass().getName());
stream.println();
if (item.getBlockTicker() != null) {
stream.println("Ticker-Info:");
stream.println(" Type: " + (item.getBlockTicker().isSynchronized() ? "Synchronized" : "Asynchronous"));
stream.println();
}
if (item instanceof EnergyNetProvider) {
stream.println("Ticker-Info:");
stream.println(" Type: Indirect (Energy Network)");
stream.println();
}
stream.println("Slimefun Data:");
stream.println(" ID: " + item.getID());
stream.println(" Inventory: " + BlockStorage.getStorage(l.getWorld()).hasInventory(l));
stream.println(" Data: " + BlockStorage.getBlockInfoAsJson(l));
stream.println();
});
}
public ErrorReport(Throwable throwable, SlimefunItem item) {
this(throwable, item.getAddon(), stream -> {
stream.println("SlimefunItem:");
stream.println(" ID: " + item.getID());
stream.println(" Plugin: " + (item.getAddon() == null ? "Unknown" : item.getAddon().getName()));
stream.println();
});
}
private static void scanPlugins(List<String> plugins, List<String> addons) {
@ -174,11 +215,7 @@ public class ErrorReport {
return newFile;
}
public File getFile() {
return file;
}
public static void tryCatch(Function<Exception, ErrorReport> function, Runnable runnable) {
public static void tryCatch(Function<Exception, ErrorReport<Exception>> function, Runnable runnable) {
try {
runnable.run();
}

View File

@ -62,16 +62,7 @@ public final class TeleportationManager {
Location l = waypoint.getLocation();
double time = DoubleHandler.fixDouble(0.5 * getTeleportationTime(complexity, source, l));
String[] lore = {
"",
"&8\u21E8 &7" + SlimefunPlugin.getLocalization().getResourceString(p, "tooltips.world") + ": &f" + l.getWorld().getName(),
"&8\u21E8 &7X: &f" + l.getX(),
"&8\u21E8 &7Y: &f" + l.getY(),
"&8\u21E8 &7Z: &f" + l.getZ(),
"&8\u21E8 &7" + SlimefunPlugin.getLocalization().getMessage(p, "machines.TELEPORTER.gui.time") + ": &f" + time + "s",
"",
"&8\u21E8 &c" + SlimefunPlugin.getLocalization().getMessage(p, "machines.TELEPORTER.gui.tooltip")
};
String[] lore = { "", "&8\u21E8 &7" + SlimefunPlugin.getLocalization().getResourceString(p, "tooltips.world") + ": &f" + l.getWorld().getName(), "&8\u21E8 &7X: &f" + l.getX(), "&8\u21E8 &7Y: &f" + l.getY(), "&8\u21E8 &7Z: &f" + l.getZ(), "&8\u21E8 &7" + SlimefunPlugin.getLocalization().getMessage(p, "machines.TELEPORTER.gui.time") + ": &f" + time + "s", "", "&8\u21E8 &c" + SlimefunPlugin.getLocalization().getMessage(p, "machines.TELEPORTER.gui.tooltip") };
menu.addItem(slot, new CustomItem(waypoint.getIcon(), waypoint.getName().replace("player:death ", ""), lore));
menu.addMenuClickHandler(slot, (pl, s, item, action) -> {
@ -112,7 +103,7 @@ public final class TeleportationManager {
}
private boolean isValid(Player p, Location source) {
return p != null && p.getLocation().distanceSquared(source) < 2.0;
return p != null && p.isValid() && p.getWorld().getUID().equals(source.getWorld().getUID()) && p.getLocation().distanceSquared(source) < 2.0;
}
private void cancel(UUID uuid, Player p) {

View File

@ -1,11 +1,5 @@
package io.github.thebusybiscuit.slimefun4.core.commands.subcommands;
import java.util.Locale;
import java.util.Optional;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.players.PlayerList;
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
@ -14,6 +8,13 @@ import io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlockMachine;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.utils.PatternUtils;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
class GiveCommand extends SubCommand {
@ -65,7 +66,13 @@ class GiveCommand extends SubCommand {
if (amount > 0) {
SlimefunPlugin.getLocalization().sendMessage(p, "messages.given-item", true, msg -> msg.replace(PLACEHOLDER_ITEM, sfItem.getItemName()).replace(PLACEHOLDER_AMOUNT, String.valueOf(amount)));
p.getInventory().addItem(new CustomItem(sfItem.getItem(), amount));
Map<Integer,ItemStack> excess = p.getInventory().addItem(new CustomItem(sfItem.getItem(), amount));
if (SlimefunPlugin.getCfg().getBoolean("options.drop-excess-sf-give-items") && !excess.isEmpty()) {
for (ItemStack is : excess.values()) {
p.getWorld().dropItem(p.getLocation(), is);
}
}
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 {

View File

@ -233,8 +233,8 @@ public class EnergyNet extends Network {
}
}
catch (Exception | LinkageError t) {
explodedBlocks.add(loc);
new ErrorReport(t, loc, item);
exploded.add(loc);
new ErrorReport<>(t, loc, item);
}
long time = SlimefunPlugin.getProfiler().closeEntry(loc, item, timestamp);

View File

@ -94,8 +94,9 @@ public class UpdaterService {
* @return The build number of this Slimefun.
*/
public int getBuildNumber() {
if (updater != null && PatternUtils.NUMERIC.matcher(this.updater.getLocalVersion()).matches())
return Integer.parseInt(this.updater.getLocalVersion());
if (updater != null && PatternUtils.NUMERIC.matcher(this.updater.getLocalVersion()).matches()) {
return Integer.parseInt(updater.getLocalVersion());
}
return -1;
}

View File

@ -834,14 +834,14 @@ public final class SlimefunItems {
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
TABLE_SAW = new SlimefunItemStack("TABLE_SAW", Material.STONECUTTER, "&6Table Saw", "", "&aAllows you to get 8 planks from 1 Log", "&a(Works with all log types)");
MAKESHIFT_SMELTERY = new SlimefunItemStack("MAKESHIFT_SMELTERY", Material.BLAST_FURNACE, "&eMakeshift Smeltery", "", "&fImprovised version of the Smeltery", "&fthat only allows you to", "&fsmelt dusts into ingots");
AUTO_DRIER = new SlimefunItemStack("AUTO_DRIER", Material.SMOKER, "&eAuto Drier", "", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.MACHINE), LoreBuilder.speed(1), LoreBuilder.powerPerSecond(10));
AUTO_BREWER = new SlimefunItemStack("AUTO_BREWER", Material.SMOKER, "&eAuto Brewer", "", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.MACHINE), LoreBuilder.speed(1), LoreBuilder.powerPerSecond(12));
AUTO_DRIER = new SlimefunItemStack("AUTO_DRIER", Material.SMOKER, "&6Auto Drier", "", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.MACHINE), LoreBuilder.speed(1), LoreBuilder.powerPerSecond(10));
AUTO_BREWER = new SlimefunItemStack("AUTO_BREWER", Material.SMOKER, "&6Auto Brewer", "", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.MACHINE), LoreBuilder.speed(1), LoreBuilder.powerPerSecond(12));
}
else {
TABLE_SAW = null;
MAKESHIFT_SMELTERY = new SlimefunItemStack("MAKESHIFT_SMELTERY", Material.FURNACE, "&eMakeshift Smeltery", "", "&fImprovised version of the Smeltery", "&fthat only allows you to", "&fsmelt dusts into ingots");
AUTO_DRIER = new SlimefunItemStack("AUTO_DRIER", Material.FURNACE, "&eAuto Drier", "", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.MACHINE), LoreBuilder.speed(1), LoreBuilder.powerPerSecond(10));
AUTO_BREWER = new SlimefunItemStack("AUTO_BREWER", Material.BREWING_STAND, "&eAuto Brewer", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.MACHINE), LoreBuilder.speed(1), LoreBuilder.powerPerSecond(12));
AUTO_DRIER = new SlimefunItemStack("AUTO_DRIER", Material.FURNACE, "&6Auto Drier", "", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.MACHINE), LoreBuilder.speed(1), LoreBuilder.powerPerSecond(10));
AUTO_BREWER = new SlimefunItemStack("AUTO_BREWER", Material.BREWING_STAND, "&6Auto Brewer", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.MACHINE), LoreBuilder.speed(1), LoreBuilder.powerPerSecond(12));
}
}
}

View File

@ -6,11 +6,9 @@ import java.util.List;
import java.util.Locale;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
import io.github.thebusybiscuit.cscorelib2.chat.ChatInput;
@ -29,6 +27,7 @@ import io.github.thebusybiscuit.slimefun4.core.researching.Research;
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.itemstack.SlimefunGuideItem;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.api.Slimefun;
@ -39,20 +38,7 @@ public class BookSlimefunGuide implements SlimefunGuideImplementation {
private final ItemStack item;
public BookSlimefunGuide() {
item = new ItemStack(Material.ENCHANTED_BOOK);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColors.color("&aSlimefun Guide &7(Book GUI)"));
List<String> lore = new LinkedList<>();
lore.add("");
lore.add(ChatColors.color("&eRight Click &8\u21E8 &7Browse Items"));
lore.add(ChatColors.color("&eShift + Right Click &8\u21E8 &7Open Settings / Credits"));
meta.setLore(lore);
SlimefunPlugin.getItemTextureService().setTexture(meta, "SLIMEFUN_GUIDE");
item.setItemMeta(meta);
item = new SlimefunGuideItem(this, "&aSlimefun Guide &7(Book GUI)");
}
@Override

View File

@ -1,18 +1,12 @@
package io.github.thebusybiscuit.slimefun4.implementation.guide;
import java.util.LinkedList;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideLayout;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import io.github.thebusybiscuit.slimefun4.utils.itemstack.SlimefunGuideItem;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
public class CheatSheetSlimefunGuide extends ChestSlimefunGuide {
@ -22,20 +16,7 @@ public class CheatSheetSlimefunGuide extends ChestSlimefunGuide {
public CheatSheetSlimefunGuide() {
super(false);
item = new ItemStack(Material.ENCHANTED_BOOK);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColors.color("&cSlimefun Guide &4(Cheat Sheet)"));
List<String> lore = new LinkedList<>();
lore.add(ChatColors.color("&4&lOnly openable by Admins"));
lore.add(ChatColors.color("&eRight Click &8\u21E8 &7Browse Items"));
lore.add(ChatColors.color("&eShift + Right Click &8\u21E8 &7Open Settings / Credits"));
meta.setLore(lore);
SlimefunPlugin.getItemTextureService().setTexture(meta, "SLIMEFUN_GUIDE");
item.setItemMeta(meta);
item = new SlimefunGuideItem(this, "&cSlimefun Guide &4(Cheat Sheet)");
}
@Override

View File

@ -18,9 +18,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.Recipe;
import org.bukkit.inventory.RecipeChoice;
import org.bukkit.inventory.RecipeChoice.MaterialChoice;
import org.bukkit.inventory.meta.ItemMeta;
import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
import io.github.thebusybiscuit.cscorelib2.chat.ChatInput;
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
@ -41,6 +39,7 @@ import io.github.thebusybiscuit.slimefun4.core.researching.Research;
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.itemstack.SlimefunGuideItem;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.MenuClickHandler;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
@ -59,6 +58,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
public ChestSlimefunGuide(boolean vanillaRecipes) {
showVanillaRecipes = vanillaRecipes;
item = new SlimefunGuideItem(this, "&aSlimefun Guide &7(Chest GUI)");
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
sound = Sound.ITEM_BOOK_PAGE_TURN;
@ -66,21 +66,6 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
else {
sound = Sound.ENTITY_BAT_TAKEOFF;
}
item = new ItemStack(Material.ENCHANTED_BOOK);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColors.color("&aSlimefun Guide &7(Chest GUI)"));
List<String> lore = new LinkedList<>();
lore.add("");
lore.add(ChatColors.color("&eRight Click &8\u21E8 &7Browse Items"));
lore.add(ChatColors.color("&eShift + Right Click &8\u21E8 &7Open Settings / Credits"));
meta.setLore(lore);
SlimefunPlugin.getItemTextureService().setTexture(meta, "SLIMEFUN_GUIDE");
item.setItemMeta(meta);
}
@Override

View File

@ -23,10 +23,10 @@ import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
* @see FarmerAndroid
*
*/
public abstract class AdvancedFarmerAndroid extends FarmerAndroid {
public class AdvancedFarmerAndroid extends FarmerAndroid {
public AdvancedFarmerAndroid(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
public AdvancedFarmerAndroid(Category category, int tier, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, tier, item, recipeType, recipe);
}
@Override

View File

@ -16,12 +16,12 @@ import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
public abstract class ButcherAndroid extends ProgrammableAndroid {
public class ButcherAndroid extends ProgrammableAndroid {
private static final String METADATA_KEY = "android_killer";
public ButcherAndroid(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
public ButcherAndroid(Category category, int tier, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, tier, item, recipeType, recipe);
}
@Override

View File

@ -17,10 +17,10 @@ import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
public abstract class FarmerAndroid extends ProgrammableAndroid {
public class FarmerAndroid extends ProgrammableAndroid {
public FarmerAndroid(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
public FarmerAndroid(Category category, int tier, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, tier, item, recipeType, recipe);
}
@Override

View File

@ -17,12 +17,12 @@ import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
public abstract class FisherAndroid extends ProgrammableAndroid {
public class FisherAndroid extends ProgrammableAndroid {
private final RandomizedSet<ItemStack> fishingLoot = new RandomizedSet<>();
public FisherAndroid(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
public FisherAndroid(Category category, int tier, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, tier, item, recipeType, recipe);
// Fish
for (Material fish : MaterialCollections.getAllFishItems()) {

View File

@ -22,13 +22,13 @@ import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
public abstract class MinerAndroid extends ProgrammableAndroid {
public class MinerAndroid extends ProgrammableAndroid {
// Determines the drops a miner android will get
private final ItemStack effectivePickaxe = new ItemStack(Material.DIAMOND_PICKAXE);
public MinerAndroid(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
public MinerAndroid(Category category, int tier, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, tier, item, recipeType, recipe);
}
@Override

View File

@ -36,6 +36,7 @@ import io.github.thebusybiscuit.slimefun4.core.handlers.BlockPlaceHandler;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import io.github.thebusybiscuit.slimefun4.utils.HeadTexture;
import io.github.thebusybiscuit.slimefun4.utils.NumberUtils;
import io.github.thebusybiscuit.slimefun4.utils.PatternUtils;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
@ -59,7 +60,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 ProgrammableAndroid extends SlimefunItem implements InventoryBlock, RecipeDisplayItem {
public class ProgrammableAndroid extends SlimefunItem implements InventoryBlock, RecipeDisplayItem {
private static final List<BlockFace> POSSIBLE_ROTATIONS = Arrays.asList(BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST);
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 };
@ -68,10 +69,12 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
protected final List<MachineFuel> fuelTypes = new ArrayList<>();
protected final String texture;
private final int tier;
public ProgrammableAndroid(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
public ProgrammableAndroid(Category category, int tier, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
this.tier = tier;
texture = item.getSkullTexture().orElse(null);
registerDefaultFuelTypes();
@ -95,7 +98,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
@Override
public void newInstance(BlockMenu menu, Block b) {
menu.replaceExistingItem(15, new CustomItem(SlimefunUtils.getCustomHead("e01c7b5726178974b3b3a01b42a590e54366026fd43808f2a787648843a7f5a"), "&aStart/Continue"));
menu.replaceExistingItem(15, new CustomItem(HeadTexture.SCRIPT_START.getAsItemStack(), "&aStart/Continue"));
menu.addMenuClickHandler(15, (p, slot, item, action) -> {
SlimefunPlugin.getLocalization().sendMessage(p, "android.started", true);
BlockStorage.addBlockInfo(b, "paused", "false");
@ -103,14 +106,14 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
return false;
});
menu.replaceExistingItem(17, new CustomItem(SlimefunUtils.getCustomHead("16139fd1c5654e56e9e4e2c8be7eb2bd5b499d633616663feee99b74352ad64"), "&4Pause"));
menu.replaceExistingItem(17, new CustomItem(HeadTexture.SCRIPT_PAUSE.getAsItemStack(), "&4Pause"));
menu.addMenuClickHandler(17, (p, slot, item, action) -> {
BlockStorage.addBlockInfo(b, "paused", "true");
SlimefunPlugin.getLocalization().sendMessage(p, "android.stopped", true);
return false;
});
menu.replaceExistingItem(16, new CustomItem(SlimefunUtils.getCustomHead("d78f2b7e5e75639ea7fb796c35d364c4df28b4243e66b76277aadcd6261337"), "&bMemory Core", "", "&8\u21E8 &7Click to open the Script Editor"));
menu.replaceExistingItem(16, new CustomItem(HeadTexture.ENERGY_REGULATOR.getAsItemStack(), "&bMemory Core", "", "&8\u21E8 &7Click to open the Script Editor"));
menu.addMenuClickHandler(16, (p, slot, item, action) -> {
BlockStorage.addBlockInfo(b, "paused", "true");
SlimefunPlugin.getLocalization().sendMessage(p, "android.stopped", true);
@ -235,7 +238,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
boolean hasFreeSlot = script.length < 54;
if (hasFreeSlot) {
menu.addItem(i, new CustomItem(SlimefunUtils.getCustomHead("171d8979c1878a05987a7faf21b56d1b744f9d068c74cffcde1ea1edad5852"), "&7> Add new Command"));
menu.addItem(i, new CustomItem(HeadTexture.SCRIPT_NEW.getAsItemStack(), "&7> Add new Command"));
menu.addMenuClickHandler(i, (pl, slot, item, action) -> {
editInstruction(pl, b, script, index);
return false;
@ -359,7 +362,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
return false;
});
menu.addItem(48, new CustomItem(SlimefunUtils.getCustomHead("105a2cab8b68ea57e3af992a36e47c8ff9aa87cc8776281966f8c3cf31a38"), "&eUpload a Script", "", "&6Click &7to upload your Android's Script", "&7to the Server's database"));
menu.addItem(48, new CustomItem(HeadTexture.SCRIPT_UP.getAsItemStack(), "&eUpload a Script", "", "&6Click &7to upload your Android's Script", "&7to the Server's database"));
menu.addMenuClickHandler(48, (pl, slot, item, action) -> {
uploadScript(pl, b, page);
return false;
@ -377,7 +380,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
return false;
});
menu.addItem(53, new CustomItem(SlimefunUtils.getCustomHead("a185c97dbb8353de652698d24b64327b793a3f32a98be67b719fbedab35e"), "&6> Back", "", "&7Return to the Android's interface"));
menu.addItem(53, new CustomItem(HeadTexture.SCRIPT_LEFT.getAsItemStack(), "&6> Back", "", "&7Return to the Android's interface"));
menu.addMenuClickHandler(53, (pl, slot, item, action) -> {
openScriptEditor(pl, b);
return false;
@ -457,25 +460,25 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
public void openScriptEditor(Player p, Block b) {
ChestMenu menu = new ChestMenu(ChatColor.DARK_AQUA + SlimefunPlugin.getLocalization().getMessage(p, "android.scripts.editor"));
menu.addItem(1, new CustomItem(SlimefunUtils.getCustomHead("d9bf6db4aeda9d8822b9f736538e8c18b9a4844f84eb45504adfbfee87eb"), "&2> Edit Script", "", "&aEdits your current Script"));
menu.addItem(1, new CustomItem(HeadTexture.SCRIPT_FORWARD.getAsItemStack(), "&2> Edit Script", "", "&aEdits your current Script"));
menu.addMenuClickHandler(1, (pl, slot, item, action) -> {
openScript(pl, b, getScript(b.getLocation()));
return false;
});
menu.addItem(3, new CustomItem(SlimefunUtils.getCustomHead("171d8979c1878a05987a7faf21b56d1b744f9d068c74cffcde1ea1edad5852"), "&4> Create new Script", "", "&cDeletes your current Script", "&cand creates a blank one"));
menu.addItem(3, new CustomItem(HeadTexture.SCRIPT_NEW.getAsItemStack(), "&4> Create new Script", "", "&cDeletes your current Script", "&cand creates a blank one"));
menu.addMenuClickHandler(3, (pl, slot, item, action) -> {
openScript(pl, b, DEFAULT_SCRIPT);
return false;
});
menu.addItem(5, new CustomItem(SlimefunUtils.getCustomHead("c01586e39f6ffa63b4fb301b65ca7da8a92f7353aaab89d3886579125dfbaf9"), "&6> Download a Script", "", "&eDownload a Script from the Server", "&eYou can edit or simply use it"));
menu.addItem(5, new CustomItem(HeadTexture.SCRIPT_DOWN.getAsItemStack(), "&6> Download a Script", "", "&eDownload a Script from the Server", "&eYou can edit or simply use it"));
menu.addMenuClickHandler(5, (pl, slot, item, action) -> {
openScriptDownloader(pl, b, 1);
return false;
});
menu.addItem(8, new CustomItem(SlimefunUtils.getCustomHead("a185c97dbb8353de652698d24b64327b793a3f32a98be67b719fbedab35e"), "&6> Back", "", "&7Return to the Android's interface"));
menu.addItem(8, new CustomItem(HeadTexture.SCRIPT_LEFT.getAsItemStack(), "&6> Back", "", "&7Return to the Android's interface"));
menu.addMenuClickHandler(8, (pl, slot, item, action) -> {
BlockStorage.getInventory(b).open(p);
return false;
@ -504,7 +507,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
ChestMenu menu = new ChestMenu(ChatColor.DARK_AQUA + SlimefunPlugin.getLocalization().getMessage(p, "android.scripts.editor"));
ChestMenuUtils.drawBackground(menu, 0, 1, 2, 3, 4, 5, 6, 7, 8);
menu.addItem(9, new CustomItem(SlimefunUtils.getCustomHead("16139fd1c5654e56e9e4e2c8be7eb2bd5b499d633616663feee99b74352ad64"), "&fDo nothing"), (pl, slot, item, action) -> {
menu.addItem(9, new CustomItem(HeadTexture.SCRIPT_PAUSE.getAsItemStack(), "&fDo nothing"), (pl, slot, item, action) -> {
String code = deleteInstruction(script, index);
setScript(b.getLocation(), code);
openScript(p, b, code);
@ -609,9 +612,9 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
return new int[] { 20, 21, 22, 29, 30, 31 };
}
public abstract float getFuelEfficiency();
public abstract int getTier();
public int getTier() {
return tier;
}
protected void tick(Block b, Config data) {
if (b.getType() != Material.PLAYER_HEAD) {
@ -774,7 +777,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
menu.pushItem(new ItemStack(Material.BUCKET), getOutputSlots());
}
int fuelLevel = (int) (fuel.getTicks() * getFuelEfficiency());
int fuelLevel = fuel.getTicks();
BlockStorage.addBlockInfo(b, "fuel", String.valueOf(fuelLevel));
break;
}

View File

@ -23,12 +23,12 @@ import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
public abstract class WoodcutterAndroid extends ProgrammableAndroid {
public class WoodcutterAndroid extends ProgrammableAndroid {
private static final int MAX_REACH = 160;
public WoodcutterAndroid(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
public WoodcutterAndroid(Category category, int tier, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, tier, item, recipeType, recipe);
}
@Override

View File

@ -4,20 +4,16 @@ import java.util.EnumMap;
import java.util.Map;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionType;
import io.github.thebusybiscuit.cscorelib2.inventory.InvUtils;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
@ -58,52 +54,7 @@ public abstract class AutoBrewer extends AContainer {
}
@Override
protected void tick(Block b) {
BlockMenu menu = BlockStorage.getInventory(b.getLocation());
if (isProcessing(b)) {
int timeleft = progress.get(b);
if (timeleft > 0) {
ChestMenuUtils.updateProgressbar(menu, 22, timeleft, processing.get(b).getTicks(), getProgressBar());
if (getCharge(b.getLocation()) < getEnergyConsumption()) {
return;
}
removeCharge(b.getLocation(), getEnergyConsumption());
progress.put(b, timeleft - 1);
}
else {
menu.replaceExistingItem(22, new CustomItem(new ItemStack(Material.BLACK_STAINED_GLASS_PANE), " "));
for (ItemStack item : processing.get(b).getOutput()) {
menu.pushItem(item, getOutputSlots());
}
progress.remove(b);
processing.remove(b);
}
}
else {
MachineRecipe recipe = findRecipe(menu);
if (recipe != null) {
if (!InvUtils.fitAll(menu.toInventory(), recipe.getOutput(), getOutputSlots())) {
return;
}
for (int slot : getInputSlots()) {
menu.consumeItem(slot);
}
processing.put(b, recipe);
progress.put(b, recipe.getTicks());
}
}
}
private MachineRecipe findRecipe(BlockMenu menu) {
protected MachineRecipe findNextRecipe(BlockMenu menu) {
ItemStack input1 = menu.getItemInSlot(getInputSlots()[0]);
ItemStack input2 = menu.getItemInSlot(getInputSlots()[1]);
@ -112,15 +63,15 @@ public abstract class AutoBrewer extends AContainer {
}
if (isPotion(input1.getType()) || isPotion(input2.getType())) {
boolean slot = isPotion(input1.getType());
ItemStack ingredient = slot ? input2 : input1;
boolean isPotionInFirstSlot = isPotion(input1.getType());
ItemStack ingredient = isPotionInFirstSlot ? input2 : input1;
// Reject any named items
if (ingredient.hasItemMeta()) {
return null;
}
ItemStack potionItem = slot ? input1 : input2;
ItemStack potionItem = isPotionInFirstSlot ? input1 : input2;
PotionMeta potion = (PotionMeta) potionItem.getItemMeta();
ItemStack output = brew(ingredient.getType(), potionItem.getType(), potion);
@ -129,6 +80,15 @@ public abstract class AutoBrewer extends AContainer {
}
output.setItemMeta(potion);
if (!InvUtils.fits(menu.toInventory(), output, getOutputSlots())) {
return null;
}
for (int slot : getInputSlots()) {
menu.consumeItem(slot);
}
return new MachineRecipe(30, new ItemStack[] { input1, input2 }, new ItemStack[] { output });
}
else {
@ -154,15 +114,15 @@ public abstract class AutoBrewer extends AContainer {
else if (potionType == Material.SPLASH_POTION && input == Material.DRAGON_BREATH) {
return new ItemStack(Material.LINGERING_POTION);
}
else {
return null;
}
}
else if (input == Material.FERMENTED_SPIDER_EYE) {
potion.setBasePotionData(new PotionData(fermentations.get(data.getType()), false, false));
PotionType fermented = fermentations.get(data.getType());
if (fermented != null) {
potion.setBasePotionData(new PotionData(fermented, false, false));
return new ItemStack(potionType);
}
}
else if (input == Material.REDSTONE) {
potion.setBasePotionData(new PotionData(data.getType(), true, data.isUpgraded()));
return new ItemStack(potionType);
@ -171,13 +131,16 @@ public abstract class AutoBrewer extends AContainer {
potion.setBasePotionData(new PotionData(data.getType(), data.isExtended(), true));
return new ItemStack(potionType);
}
else if (data.getType() == PotionType.AWKWARD && potionRecipes.containsKey(input)) {
potion.setBasePotionData(new PotionData(potionRecipes.get(input), false, false));
else if (data.getType() == PotionType.AWKWARD) {
PotionType potionRecipe = potionRecipes.get(input);
if (potionRecipe != null) {
potion.setBasePotionData(new PotionData(potionRecipe, false, false));
return new ItemStack(potionType);
}
else {
return null;
}
return null;
}
/**
@ -192,14 +155,9 @@ public abstract class AutoBrewer extends AContainer {
return mat == Material.POTION || mat == Material.SPLASH_POTION || mat == Material.LINGERING_POTION;
}
@Override
public String getInventoryTitle() {
return "&6Auto-Brewer";
}
@Override
public ItemStack getProgressBar() {
return new ItemStack(Material.CARROT_ON_A_STICK);
return new ItemStack(Material.FISHING_ROD);
}
@Override

View File

@ -48,11 +48,6 @@ public class AutoDisenchanter extends AContainer {
super(category, item, recipeType, recipe);
}
@Override
public String getInventoryTitle() {
return "&5Auto-Disenchanter";
}
@Override
public ItemStack getProgressBar() {
return new ItemStack(Material.DIAMOND_CHESTPLATE);

View File

@ -91,11 +91,6 @@ public class AutoDrier extends AContainer implements RecipeDisplayItem {
}
}
@Override
public String getInventoryTitle() {
return "&eAuto Drier";
}
@Override
public ItemStack getProgressBar() {
return new ItemStack(Material.FLINT_AND_STEEL);

View File

@ -36,11 +36,6 @@ public class AutoEnchanter extends AContainer {
emeraldEnchantsLimit = SlimefunPlugin.getCfg().getInt("options.emerald-enchantment-limit");
}
@Override
public String getInventoryTitle() {
return "&5Auto-Enchanter";
}
@Override
public ItemStack getProgressBar() {
return new ItemStack(Material.GOLDEN_CHESTPLATE);

View File

@ -37,9 +37,4 @@ public abstract class CarbonPress extends AContainer implements RecipeDisplayIte
return new ItemStack(Material.DIAMOND_PICKAXE);
}
@Override
public String getInventoryTitle() {
return "&cCarbon Press";
}
}

View File

@ -13,17 +13,20 @@ import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
/**
* The {@link ChargingBench} is a powered machine that can be used to charge any {@link Rechargeable} item.
*
* @author TheBusyBiscuit
*
* @see Rechargeable
*
*/
public class ChargingBench extends AContainer {
public ChargingBench(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
}
@Override
public String getInventoryTitle() {
return "&3Charging Bench";
}
@Override
public ItemStack getProgressBar() {
return new ItemStack(Material.GOLDEN_PICKAXE);

View File

@ -36,11 +36,6 @@ public abstract class ElectricDustWasher extends AContainer {
oreWasher = (OreWasher) SlimefunItems.ORE_WASHER.getItem();
}
@Override
public String getInventoryTitle() {
return "&bElectric Dust Washer";
}
@Override
public ItemStack getProgressBar() {
return new ItemStack(Material.GOLDEN_SHOVEL);

View File

@ -43,9 +43,4 @@ public abstract class ElectricFurnace extends AContainer {
return new ItemStack(Material.FLINT_AND_STEEL);
}
@Override
public String getInventoryTitle() {
return "&bElectric Furnace";
}
}

View File

@ -40,11 +40,6 @@ public abstract class ElectricGoldPan extends AContainer implements RecipeDispla
return recipes;
}
@Override
public String getInventoryTitle() {
return "&6Electric Gold Pan";
}
@Override
public ItemStack getProgressBar() {
return new ItemStack(Material.DIAMOND_SHOVEL);

View File

@ -25,9 +25,4 @@ public abstract class ElectricIngotFactory extends AContainer implements RecipeD
return new ItemStack(Material.FLINT_AND_STEEL);
}
@Override
public String getInventoryTitle() {
return "&cElectric Ingot Factory";
}
}

View File

@ -29,11 +29,6 @@ public class ElectricIngotPulverizer extends AContainer implements RecipeDisplay
super(category, item, recipeType, recipe);
}
@Override
public String getInventoryTitle() {
return "&bElectric Ingot Pulverizer";
}
@Override
public ItemStack getProgressBar() {
return new ItemStack(Material.IRON_PICKAXE);

View File

@ -25,9 +25,4 @@ public abstract class ElectricOreGrinder extends AContainer implements RecipeDis
return new ItemStack(Material.IRON_PICKAXE);
}
@Override
public String getInventoryTitle() {
return "&bElectric Ore Grinder";
}
}

View File

@ -19,7 +19,7 @@ public abstract class ElectricPress extends AContainer implements RecipeDisplayI
@Override
protected void registerDefaultRecipes() {
addRecipe(4, new CustomItem(SlimefunItems.STONE_CHUNK, 3), new ItemStack(Material.COBBLESTONE));
addRecipe(4, new SlimefunItemStack(SlimefunItems.STONE_CHUNK, 3), new ItemStack(Material.COBBLESTONE));
addRecipe(4, new ItemStack(Material.FLINT, 6), new ItemStack(Material.COBBLESTONE));
addRecipe(5, new ItemStack(Material.GLASS), new ItemStack(Material.GLASS_PANE, 3));
addRecipe(4, new ItemStack(Material.SNOWBALL, 4), new ItemStack(Material.SNOW_BLOCK));
@ -30,19 +30,19 @@ public abstract class ElectricPress extends AContainer implements RecipeDisplayI
addRecipe(3, new ItemStack(Material.CLAY_BALL, 4), new ItemStack(Material.CLAY));
addRecipe(6, SlimefunItems.COPPER_INGOT, new CustomItem(SlimefunItems.COPPER_WIRE, 3));
addRecipe(16, new CustomItem(SlimefunItems.STEEL_INGOT, 8), SlimefunItems.STEEL_PLATE);
addRecipe(18, new CustomItem(SlimefunItems.REINFORCED_ALLOY_INGOT, 8), SlimefunItems.REINFORCED_PLATE);
addRecipe(16, new SlimefunItemStack(SlimefunItems.STEEL_INGOT, 8), SlimefunItems.STEEL_PLATE);
addRecipe(18, new SlimefunItemStack(SlimefunItems.REINFORCED_ALLOY_INGOT, 8), SlimefunItems.REINFORCED_PLATE);
addRecipe(8, new ItemStack(Material.NETHER_WART), new CustomItem(SlimefunItems.MAGIC_LUMP_1, 2));
addRecipe(10, new CustomItem(SlimefunItems.MAGIC_LUMP_1, 4), SlimefunItems.MAGIC_LUMP_2);
addRecipe(12, new CustomItem(SlimefunItems.MAGIC_LUMP_2, 4), SlimefunItems.MAGIC_LUMP_3);
addRecipe(10, new SlimefunItemStack(SlimefunItems.MAGIC_LUMP_1, 4), SlimefunItems.MAGIC_LUMP_2);
addRecipe(12, new SlimefunItemStack(SlimefunItems.MAGIC_LUMP_2, 4), SlimefunItems.MAGIC_LUMP_3);
addRecipe(10, new ItemStack(Material.ENDER_EYE), new CustomItem(SlimefunItems.ENDER_LUMP_1, 2));
addRecipe(12, new CustomItem(SlimefunItems.ENDER_LUMP_1, 4), SlimefunItems.ENDER_LUMP_2);
addRecipe(14, new CustomItem(SlimefunItems.ENDER_LUMP_2, 4), SlimefunItems.ENDER_LUMP_3);
addRecipe(12, new SlimefunItemStack(SlimefunItems.ENDER_LUMP_1, 4), SlimefunItems.ENDER_LUMP_2);
addRecipe(14, new SlimefunItemStack(SlimefunItems.ENDER_LUMP_2, 4), SlimefunItems.ENDER_LUMP_3);
addRecipe(18, new CustomItem(SlimefunItems.TINY_URANIUM, 9), SlimefunItems.SMALL_URANIUM);
addRecipe(24, new CustomItem(SlimefunItems.SMALL_URANIUM, 4), SlimefunItems.URANIUM);
addRecipe(18, new SlimefunItemStack(SlimefunItems.TINY_URANIUM, 9), SlimefunItems.SMALL_URANIUM);
addRecipe(24, new SlimefunItemStack(SlimefunItems.SMALL_URANIUM, 4), SlimefunItems.URANIUM);
addRecipe(4, new ItemStack(Material.QUARTZ, 4), new ItemStack(Material.QUARTZ_BLOCK));
addRecipe(4, new ItemStack(Material.IRON_NUGGET, 9), new ItemStack(Material.IRON_INGOT));
@ -65,12 +65,6 @@ public abstract class ElectricPress extends AContainer implements RecipeDisplayI
registerRecipe(seconds, new ItemStack[] { input }, new ItemStack[] { output });
}
@Override
public String getInventoryTitle() {
return "&eElectric Press";
}
@Override
public ItemStack getProgressBar() {
return new ItemStack(Material.IRON_HOE);

View File

@ -14,6 +14,7 @@ import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.items.multiblocks.Smeltery;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
@ -28,6 +29,12 @@ import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
import me.mrCookieSlime.Slimefun.api.inventory.DirtyChestMenu;
import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow;
/**
* The {@link ElectricSmeltery} is an electric version of the standard {@link Smeltery}.
*
* @author TheBusyBiscuit
*
*/
public abstract class ElectricSmeltery extends AContainer {
private static final int[] border = { 4, 5, 6, 7, 8, 13, 31, 40, 41, 42, 43, 44 };
@ -37,7 +44,7 @@ public abstract class ElectricSmeltery extends AContainer {
public ElectricSmeltery(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
new BlockMenuPreset(getID(), getInventoryTitle()) {
new BlockMenuPreset(getID(), getItemName()) {
@Override
public void init() {
@ -65,8 +72,8 @@ public abstract class ElectricSmeltery extends AContainer {
for (int slot : getInputSlots()) {
ItemStack stack = menu.getItemInSlot(slot);
if (stack != null && SlimefunUtils.isItemSimilar(stack, item, true)) {
if (stack.getAmount() < stack.getMaxStackSize()) {
if (stack != null && SlimefunUtils.isItemSimilar(stack, item, true, false)) {
if (stack.getAmount() >= stack.getMaxStackSize()) {
fullSlots++;
}
@ -117,18 +124,18 @@ public abstract class ElectricSmeltery extends AContainer {
@Override
protected void constructMenu(BlockMenuPreset preset) {
for (int i : border) {
preset.addItem(i, new CustomItem(new ItemStack(Material.GRAY_STAINED_GLASS_PANE), " "), ChestMenuUtils.getEmptyClickHandler());
preset.addItem(i, new CustomItem(Material.GRAY_STAINED_GLASS_PANE, " "), ChestMenuUtils.getEmptyClickHandler());
}
for (int i : inputBorder) {
preset.addItem(i, new CustomItem(new ItemStack(Material.CYAN_STAINED_GLASS_PANE), " "), ChestMenuUtils.getEmptyClickHandler());
preset.addItem(i, new CustomItem(Material.CYAN_STAINED_GLASS_PANE, " "), ChestMenuUtils.getEmptyClickHandler());
}
for (int i : outputBorder) {
preset.addItem(i, new CustomItem(new ItemStack(Material.ORANGE_STAINED_GLASS_PANE), " "), ChestMenuUtils.getEmptyClickHandler());
preset.addItem(i, new CustomItem(Material.ORANGE_STAINED_GLASS_PANE, " "), ChestMenuUtils.getEmptyClickHandler());
}
preset.addItem(22, new CustomItem(new ItemStack(Material.BLACK_STAINED_GLASS_PANE), " "), ChestMenuUtils.getEmptyClickHandler());
preset.addItem(22, new CustomItem(Material.BLACK_STAINED_GLASS_PANE, " "), ChestMenuUtils.getEmptyClickHandler());
for (int i : getOutputSlots()) {
preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() {
@ -146,11 +153,6 @@ public abstract class ElectricSmeltery extends AContainer {
}
}
@Override
public String getInventoryTitle() {
return "&cElectric Smeltery";
}
@Override
public ItemStack getProgressBar() {
return new ItemStack(Material.FLINT_AND_STEEL);

View File

@ -41,9 +41,4 @@ public abstract class ElectrifiedCrucible extends AContainer {
return new ItemStack(Material.FLINT_AND_STEEL);
}
@Override
public String getInventoryTitle() {
return "&4Electrified Crucible";
}
}

View File

@ -46,9 +46,4 @@ public abstract class FoodComposter extends AContainer implements RecipeDisplayI
return new ItemStack(Material.GOLDEN_HOE);
}
@Override
public String getInventoryTitle() {
return "&cFood Composter";
}
}

View File

@ -45,9 +45,4 @@ public abstract class FoodFabricator extends AContainer {
return new ItemStack(Material.GOLDEN_HOE);
}
@Override
public String getInventoryTitle() {
return "&cFood Fabricator";
}
}

View File

@ -47,11 +47,6 @@ public abstract class Freezer extends AContainer implements RecipeDisplayItem {
return new ItemStack(Material.GOLDEN_PICKAXE);
}
@Override
public String getInventoryTitle() {
return "&bFreezer";
}
@Override
public String getMachineIdentifier() {
return "FREEZER";

View File

@ -28,7 +28,7 @@ public abstract class HeatedPressureChamber extends AContainer {
public HeatedPressureChamber(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
new BlockMenuPreset(getID(), getInventoryTitle()) {
new BlockMenuPreset(getID(), getItemName()) {
@Override
public void init() {
@ -94,11 +94,6 @@ public abstract class HeatedPressureChamber extends AContainer {
registerRecipe(8, new ItemStack[] { SlimefunItems.MAGNESIUM_DUST, SlimefunItems.SALT }, new ItemStack[] { SlimefunItems.MAGNESIUM_SALT });
}
@Override
public String getInventoryTitle() {
return "&cHeated Pressure Chamber";
}
@Override
public ItemStack getProgressBar() {
return new ItemStack(Material.FLINT_AND_STEEL);

View File

@ -21,11 +21,6 @@ public abstract class Refinery extends AContainer implements RecipeDisplayItem {
registerRecipe(40, SlimefunItems.OIL_BUCKET, SlimefunItems.FUEL_BUCKET);
}
@Override
public String getInventoryTitle() {
return "&cRefinery";
}
@Override
public ItemStack getProgressBar() {
return new ItemStack(Material.FLINT_AND_STEEL);

View File

@ -129,7 +129,7 @@ public class TreeGrowthAccelerator extends SlimefunItem implements InventoryBloc
removeCharge(machine.getLocation(), ENERGY_CONSUMPTION);
sapling.setStage(sapling.getStage() + 1);
block.setBlockData(sapling);
block.setBlockData(sapling, false);
inv.consumeItem(slot);
block.getWorld().spawnParticle(Particle.VILLAGER_HAPPY, block.getLocation().add(0.5D, 0.5D, 0.5D), 4, 0.1F, 0.1F, 0.1F);

View File

@ -2,6 +2,7 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.electric.reactor
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.ItemStack;
@ -44,12 +45,13 @@ public abstract class NetherStarReactor extends Reactor {
@Override
public void extraTick(Location l) {
Slimefun.runSync(() -> {
for (Entity entity : ReactorHologram.getArmorStand(l, true).getNearbyEntities(5, 5, 5)) {
if (entity instanceof LivingEntity) {
ArmorStand hologram = ReactorHologram.getArmorStand(l, true);
for (Entity entity : hologram.getNearbyEntities(5, 5, 5)) {
if (entity instanceof LivingEntity && entity.isValid()) {
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 60, 1));
}
}
}, 0L);
});
}
@Override

View File

@ -26,6 +26,7 @@ import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
import io.github.thebusybiscuit.slimefun4.utils.holograms.ReactorHologram;
import io.github.thebusybiscuit.slimefun4.utils.holograms.SimpleHologram;
import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
@ -401,9 +402,11 @@ public abstract class Reactor extends AbstractEnergyProvider {
boolean requiresCoolant = (processing.get(reactor).getTicks() - timeleft) % COOLANT_DURATION == 0;
if (requiresCoolant) {
ItemStack coolant = new ItemStackWrapper(getCoolant());
if (accessPort != null) {
for (int slot : getCoolantSlots()) {
if (SlimefunUtils.isItemSimilar(accessPort.getItemInSlot(slot), getCoolant(), true)) {
if (SlimefunUtils.isItemSimilar(accessPort.getItemInSlot(slot), coolant, true, false)) {
ItemStack remainingItem = menu.pushItem(accessPort.getItemInSlot(slot), getCoolantSlots());
accessPort.replaceExistingItem(slot, remainingItem);
}
@ -411,7 +414,7 @@ public abstract class Reactor extends AbstractEnergyProvider {
}
for (int slot : getCoolantSlots()) {
if (SlimefunUtils.isItemSimilar(menu.getItemInSlot(slot), getCoolant(), true)) {
if (SlimefunUtils.isItemSimilar(menu.getItemInSlot(slot), coolant, true, false)) {
menu.consumeItem(slot);
ReactorHologram.update(reactor, "&b\u2744 &7100%");
return true;

View File

@ -66,11 +66,6 @@ public abstract class GEOMiner extends AContainer implements RecipeDisplayItem {
};
}
@Override
public String getInventoryTitle() {
return "&6GEO-Miner";
}
@Override
public String getMachineIdentifier() {
return "GEO_MINER";
@ -112,14 +107,14 @@ public abstract class GEOMiner extends AContainer implements RecipeDisplayItem {
@Override
protected void constructMenu(BlockMenuPreset preset) {
for (int i : BORDER) {
preset.addItem(i, new CustomItem(new ItemStack(Material.GRAY_STAINED_GLASS_PANE), " "), (p, slot, item, action) -> false);
preset.addItem(i, new CustomItem(Material.GRAY_STAINED_GLASS_PANE, " "), (p, slot, item, action) -> false);
}
for (int i : OUTPUT_BORDER) {
preset.addItem(i, new CustomItem(new ItemStack(Material.ORANGE_STAINED_GLASS_PANE), " "), (p, slot, item, action) -> false);
preset.addItem(i, new CustomItem(Material.ORANGE_STAINED_GLASS_PANE, " "), (p, slot, item, action) -> false);
}
preset.addItem(4, new CustomItem(new ItemStack(Material.BLACK_STAINED_GLASS_PANE), " "), (p, slot, item, action) -> false);
preset.addItem(4, new CustomItem(Material.BLACK_STAINED_GLASS_PANE, " "), (p, slot, item, action) -> false);
for (int i : getOutputSlots()) {
preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() {

View File

@ -2198,212 +2198,56 @@ public final class SlimefunItemSetup {
new ItemStack[] {SlimefunItems.PLASTIC_SHEET, SlimefunItems.STEEL_INGOT, SlimefunItems.PLASTIC_SHEET, new ItemStack(Material.RED_STAINED_GLASS), SlimefunItems.BASIC_CIRCUIT_BOARD, SlimefunItems.STEEL_INGOT, SlimefunItems.PLASTIC_SHEET, SlimefunItems.STEEL_INGOT, SlimefunItems.PLASTIC_SHEET})
.register(plugin);
new ProgrammableAndroid(categories.androids, SlimefunItems.PROGRAMMABLE_ANDROID, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {SlimefunItems.PLASTIC_SHEET, SlimefunItems.ANDROID_MEMORY_CORE, SlimefunItems.PLASTIC_SHEET, SlimefunItems.COAL_GENERATOR, SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.CHEST), SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET}) {
@Override
public float getFuelEfficiency() {
return 1;
}
@Override
public int getTier() {
return 1;
}
}
new ProgrammableAndroid(categories.androids, 1, SlimefunItems.PROGRAMMABLE_ANDROID, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {SlimefunItems.PLASTIC_SHEET, SlimefunItems.ANDROID_MEMORY_CORE, SlimefunItems.PLASTIC_SHEET, SlimefunItems.COAL_GENERATOR, SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.CHEST), SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET})
.register(plugin);
new MinerAndroid(categories.androids, SlimefunItems.PROGRAMMABLE_ANDROID_MINER, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {null, null, null, new ItemStack(Material.DIAMOND_PICKAXE), SlimefunItems.PROGRAMMABLE_ANDROID, new ItemStack(Material.DIAMOND_PICKAXE), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
@Override
public float getFuelEfficiency() {
return 1;
}
@Override
public int getTier() {
return 1;
}
}
new MinerAndroid(categories.androids, 1, SlimefunItems.PROGRAMMABLE_ANDROID_MINER, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {null, null, null, new ItemStack(Material.DIAMOND_PICKAXE), SlimefunItems.PROGRAMMABLE_ANDROID, new ItemStack(Material.DIAMOND_PICKAXE), null, SlimefunItems.ELECTRIC_MOTOR, null})
.register(plugin);
new FarmerAndroid(categories.androids, SlimefunItems.PROGRAMMABLE_ANDROID_FARMER, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {null, null, null, new ItemStack(Material.DIAMOND_HOE), SlimefunItems.PROGRAMMABLE_ANDROID, new ItemStack(Material.DIAMOND_HOE), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
@Override
public float getFuelEfficiency() {
return 1;
}
@Override
public int getTier() {
return 1;
}
}
new FarmerAndroid(categories.androids, 1, SlimefunItems.PROGRAMMABLE_ANDROID_FARMER, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {null, null, null, new ItemStack(Material.DIAMOND_HOE), SlimefunItems.PROGRAMMABLE_ANDROID, new ItemStack(Material.DIAMOND_HOE), null, SlimefunItems.ELECTRIC_MOTOR, null})
.register(plugin);
new WoodcutterAndroid(categories.androids, SlimefunItems.PROGRAMMABLE_ANDROID_WOODCUTTER, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {null, null, null, new ItemStack(Material.DIAMOND_AXE), SlimefunItems.PROGRAMMABLE_ANDROID, new ItemStack(Material.DIAMOND_AXE), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
@Override
public float getFuelEfficiency() {
return 1;
}
@Override
public int getTier() {
return 1;
}
}
new WoodcutterAndroid(categories.androids, 1, SlimefunItems.PROGRAMMABLE_ANDROID_WOODCUTTER, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {null, null, null, new ItemStack(Material.DIAMOND_AXE), SlimefunItems.PROGRAMMABLE_ANDROID, new ItemStack(Material.DIAMOND_AXE), null, SlimefunItems.ELECTRIC_MOTOR, null})
.register(plugin);
new FisherAndroid(categories.androids, SlimefunItems.PROGRAMMABLE_ANDROID_FISHERMAN, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {null, null, null, new ItemStack(Material.FISHING_ROD), SlimefunItems.PROGRAMMABLE_ANDROID, new ItemStack(Material.FISHING_ROD), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
@Override
public float getFuelEfficiency() {
return 1;
}
@Override
public int getTier() {
return 1;
}
}
new FisherAndroid(categories.androids, 1, SlimefunItems.PROGRAMMABLE_ANDROID_FISHERMAN, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {null, null, null, new ItemStack(Material.FISHING_ROD), SlimefunItems.PROGRAMMABLE_ANDROID, new ItemStack(Material.FISHING_ROD), null, SlimefunItems.ELECTRIC_MOTOR, null})
.register(plugin);
new ButcherAndroid(categories.androids, SlimefunItems.PROGRAMMABLE_ANDROID_BUTCHER, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {null, SlimefunItems.GPS_TRANSMITTER, null, new ItemStack(Material.DIAMOND_SWORD), SlimefunItems.PROGRAMMABLE_ANDROID, new ItemStack(Material.DIAMOND_SWORD), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
@Override
public float getFuelEfficiency() {
return 1;
}
@Override
public int getTier() {
return 1;
}
}
new ButcherAndroid(categories.androids, 1, SlimefunItems.PROGRAMMABLE_ANDROID_BUTCHER, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {null, SlimefunItems.GPS_TRANSMITTER, null, new ItemStack(Material.DIAMOND_SWORD), SlimefunItems.PROGRAMMABLE_ANDROID, new ItemStack(Material.DIAMOND_SWORD), null, SlimefunItems.ELECTRIC_MOTOR, null})
.register(plugin);
new ProgrammableAndroid(categories.androids, SlimefunItems.PROGRAMMABLE_ANDROID_2, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {SlimefunItems.PLASTIC_SHEET, SlimefunItems.ANDROID_MEMORY_CORE, SlimefunItems.PLASTIC_SHEET, SlimefunItems.COMBUSTION_REACTOR, SlimefunItems.PROGRAMMABLE_ANDROID, new ItemStack(Material.CHEST), SlimefunItems.PLASTIC_SHEET, SlimefunItems.POWER_CRYSTAL, SlimefunItems.PLASTIC_SHEET}) {
@Override
public float getFuelEfficiency() {
return 1.5F;
}
@Override
public int getTier() {
return 2;
}
}
new ProgrammableAndroid(categories.androids, 2, SlimefunItems.PROGRAMMABLE_ANDROID_2, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {SlimefunItems.PLASTIC_SHEET, SlimefunItems.ANDROID_MEMORY_CORE, SlimefunItems.PLASTIC_SHEET, SlimefunItems.COMBUSTION_REACTOR, SlimefunItems.PROGRAMMABLE_ANDROID, new ItemStack(Material.CHEST), SlimefunItems.PLASTIC_SHEET, SlimefunItems.POWER_CRYSTAL, SlimefunItems.PLASTIC_SHEET})
.register(plugin);
new FisherAndroid(categories.androids, SlimefunItems.PROGRAMMABLE_ANDROID_2_FISHERMAN, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {null, null, null, new ItemStack(Material.FISHING_ROD), SlimefunItems.PROGRAMMABLE_ANDROID_2, new ItemStack(Material.FISHING_ROD), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
@Override
public float getFuelEfficiency() {
return 1.5F;
}
@Override
public int getTier() {
return 2;
}
}
new FisherAndroid(categories.androids, 2, SlimefunItems.PROGRAMMABLE_ANDROID_2_FISHERMAN, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {null, null, null, new ItemStack(Material.FISHING_ROD), SlimefunItems.PROGRAMMABLE_ANDROID_2, new ItemStack(Material.FISHING_ROD), null, SlimefunItems.ELECTRIC_MOTOR, null})
.register(plugin);
new ButcherAndroid(categories.androids, SlimefunItems.PROGRAMMABLE_ANDROID_2_BUTCHER, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {null, SlimefunItems.GPS_TRANSMITTER, null, new ItemStack(Material.DIAMOND_SWORD), SlimefunItems.PROGRAMMABLE_ANDROID_2, new ItemStack(Material.DIAMOND_SWORD), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
@Override
public float getFuelEfficiency() {
return 1.5F;
}
@Override
public int getTier() {
return 2;
}
}
new ButcherAndroid(categories.androids, 2, SlimefunItems.PROGRAMMABLE_ANDROID_2_BUTCHER, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {null, SlimefunItems.GPS_TRANSMITTER, null, new ItemStack(Material.DIAMOND_SWORD), SlimefunItems.PROGRAMMABLE_ANDROID_2, new ItemStack(Material.DIAMOND_SWORD), null, SlimefunItems.ELECTRIC_MOTOR, null})
.register(plugin);
new AdvancedFarmerAndroid(categories.androids, SlimefunItems.PROGRAMMABLE_ANDROID_2_FARMER, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {null, SlimefunItems.GPS_TRANSMITTER, null, new ItemStack(Material.DIAMOND_HOE), SlimefunItems.PROGRAMMABLE_ANDROID_2, new ItemStack(Material.DIAMOND_HOE), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
@Override
public float getFuelEfficiency() {
return 1.5F;
}
@Override
public int getTier() {
return 2;
}
}
new AdvancedFarmerAndroid(categories.androids, 2, SlimefunItems.PROGRAMMABLE_ANDROID_2_FARMER, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {null, SlimefunItems.GPS_TRANSMITTER, null, new ItemStack(Material.DIAMOND_HOE), SlimefunItems.PROGRAMMABLE_ANDROID_2, new ItemStack(Material.DIAMOND_HOE), null, SlimefunItems.ELECTRIC_MOTOR, null})
.register(plugin);
new ProgrammableAndroid(categories.androids, SlimefunItems.PROGRAMMABLE_ANDROID_3, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {SlimefunItems.PLASTIC_SHEET, SlimefunItems.ANDROID_MEMORY_CORE, SlimefunItems.PLASTIC_SHEET, SlimefunItems.NUCLEAR_REACTOR, SlimefunItems.PROGRAMMABLE_ANDROID_2, new ItemStack(Material.CHEST), SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.POWER_CRYSTAL, SlimefunItems.BLISTERING_INGOT_3}) {
@Override
public float getFuelEfficiency() {
return 1F;
}
@Override
public int getTier() {
return 3;
}
}
new ProgrammableAndroid(categories.androids, 3, SlimefunItems.PROGRAMMABLE_ANDROID_3, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {SlimefunItems.PLASTIC_SHEET, SlimefunItems.ANDROID_MEMORY_CORE, SlimefunItems.PLASTIC_SHEET, SlimefunItems.NUCLEAR_REACTOR, SlimefunItems.PROGRAMMABLE_ANDROID_2, new ItemStack(Material.CHEST), SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.POWER_CRYSTAL, SlimefunItems.BLISTERING_INGOT_3})
.register(plugin);
new FisherAndroid(categories.androids, SlimefunItems.PROGRAMMABLE_ANDROID_3_FISHERMAN, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {null, null, null, new ItemStack(Material.FISHING_ROD), SlimefunItems.PROGRAMMABLE_ANDROID_3, new ItemStack(Material.FISHING_ROD), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
@Override
public float getFuelEfficiency() {
return 1F;
}
@Override
public int getTier() {
return 3;
}
}
new FisherAndroid(categories.androids, 3, SlimefunItems.PROGRAMMABLE_ANDROID_3_FISHERMAN, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {null, null, null, new ItemStack(Material.FISHING_ROD), SlimefunItems.PROGRAMMABLE_ANDROID_3, new ItemStack(Material.FISHING_ROD), null, SlimefunItems.ELECTRIC_MOTOR, null})
.register(plugin);
new ButcherAndroid(categories.androids, SlimefunItems.PROGRAMMABLE_ANDROID_3_BUTCHER, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {null, SlimefunItems.GPS_TRANSMITTER_3, null, new ItemStack(Material.DIAMOND_SWORD), SlimefunItems.PROGRAMMABLE_ANDROID_3, new ItemStack(Material.DIAMOND_SWORD), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
@Override
public float getFuelEfficiency() {
return 1F;
}
@Override
public int getTier() {
return 3;
}
}
new ButcherAndroid(categories.androids, 3, SlimefunItems.PROGRAMMABLE_ANDROID_3_BUTCHER, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {null, SlimefunItems.GPS_TRANSMITTER_3, null, new ItemStack(Material.DIAMOND_SWORD), SlimefunItems.PROGRAMMABLE_ANDROID_3, new ItemStack(Material.DIAMOND_SWORD), null, SlimefunItems.ELECTRIC_MOTOR, null})
.register(plugin);
new SlimefunItem(categories.magicalResources, SlimefunItems.BLANK_RUNE, RecipeType.ANCIENT_ALTAR,

View File

@ -182,7 +182,7 @@ public class TickerTask implements Runnable {
if (errors == 1) {
// Generate a new Error-Report
new ErrorReport(x, l, item);
new ErrorReport<>(x, l, item);
bugs.put(position, errors);
}
else if (errors == 4) {

View File

@ -88,6 +88,8 @@ public enum HeadTexture {
SCRIPT_FARM_DOWN("2d4296b333d25319af3f33051797f9e6d821cd19a014fb7137beb86a4e9e96"),
SCRIPT_PUSH_ITEMS("90a4dbf6625c42be57a8ba2c330954a76bdf22785540e87a5c9672685238ec"),
SCRIPT_PULL_FUEL("2432f5282a50745b912be14deda581bd4a09b977a3c32d7e9578491fee8fa7"),
SCRIPT_NEW("171d8979c1878a05987a7faf21b56d1b744f9d068c74cffcde1ea1edad5852"),
SCRIPT_PAUSE("16139fd1c5654e56e9e4e2c8be7eb2bd5b499d633616663feee99b74352ad64"),
GLOBE_OVERWORLD("c9c8881e42915a9d29bb61a16fb26d059913204d265df5b439b3d792acd56"),
GLOBE_NETHER("d83571ff589f1a59bb02b80800fc736116e27c3dcf9efebede8cf1fdde"),
GLOBE_THE_END("c6cac59b2aae489aa0687b5d802b2555eb14a40bd62b21eb116fa569cdb756"),

View File

@ -40,7 +40,7 @@ public final class SimpleHologram {
Location l = new Location(b.getWorld(), b.getX() + 0.5, b.getY() + 0.7F, b.getZ() + 0.5);
for (Entity n : l.getChunk().getEntities()) {
if (n instanceof ArmorStand && l.distanceSquared(n.getLocation()) < 0.4D && n.getCustomName() != null) {
if (n instanceof ArmorStand && l.distanceSquared(n.getLocation()) < 0.4D && isPossibleHologram((ArmorStand) n)) {
return (ArmorStand) n;
}
}
@ -53,6 +53,10 @@ public final class SimpleHologram {
}
}
private static boolean isPossibleHologram(ArmorStand armorstand) {
return armorstand.isValid() && armorstand.isSilent() && armorstand.isMarker() && !armorstand.hasGravity() && armorstand.isCustomNameVisible();
}
public static ArmorStand create(Location l) {
ArmorStand armorStand = (ArmorStand) l.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
armorStand.setVisible(false);

View File

@ -25,10 +25,12 @@ public final class ItemStackWrapper extends ItemStack {
private static final String ERROR_MESSAGE = "ItemStackWrappers are immutable and not indended for actual usage.";
private final ItemMeta meta;
private final int amount;
private final boolean hasItemMeta;
public ItemStackWrapper(ItemStack item) {
super(item.getType());
amount = item.getAmount();
hasItemMeta = item.hasItemMeta();
if (hasItemMeta) {
@ -60,7 +62,7 @@ public final class ItemStackWrapper extends ItemStack {
@Override
public int getAmount() {
return 1;
return amount;
}
@Override

View File

@ -0,0 +1,46 @@
package io.github.thebusybiscuit.slimefun4.utils.itemstack;
import java.util.LinkedList;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideImplementation;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.guide.CheatSheetSlimefunGuide;
/**
* This is just a helper {@link ItemStack} class for the {@link SlimefunGuide} {@link ItemStack}.
*
* @author TheBusyBiscuit
*
* @see SlimefunGuide
* @see SlimefunGuideImplementation
*
*/
public class SlimefunGuideItem extends ItemStack {
public SlimefunGuideItem(SlimefunGuideImplementation implementation, String name) {
super(Material.ENCHANTED_BOOK);
ItemMeta meta = getItemMeta();
meta.setDisplayName(ChatColors.color(name));
List<String> lore = new LinkedList<>();
lore.add(implementation instanceof CheatSheetSlimefunGuide ? "&4&lOnly openable by Admins" : "");
lore.add(ChatColors.color("&eRight Click &8\u21E8 &7Browse Items"));
lore.add(ChatColors.color("&eShift + Right Click &8\u21E8 &7Open Settings / Credits"));
meta.setLore(lore);
SlimefunPlugin.getItemTextureService().setTexture(meta, "SLIMEFUN_GUIDE");
setItemMeta(meta);
}
}

View File

@ -18,6 +18,7 @@ import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent;
import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
@ -107,7 +108,9 @@ public abstract class AContainer extends SlimefunItem implements InventoryBlock,
*
* @return The title of the {@link Inventory} of this {@link AContainer}
*/
public abstract String getInventoryTitle();
public String getInventoryTitle() {
return getItemName();
}
/**
* This method returns the {@link ItemStack} that this {@link AContainer} will
@ -256,39 +259,54 @@ public abstract class AContainer extends SlimefunItem implements InventoryBlock,
}
}
else {
MachineRecipe r = null;
MachineRecipe next = findNextRecipe(inv);
if (next != null) {
processing.put(b, next);
progress.put(b, next.getTicks());
}
}
}
protected MachineRecipe findNextRecipe(BlockMenu inv) {
Map<Integer, ItemStack> inventory = new HashMap<>();
for (int slot : getInputSlots()) {
ItemStack item = inv.getItemInSlot(slot);
if (item != null) {
inventory.put(slot, new ItemStackWrapper(item));
}
}
Map<Integer, Integer> found = new HashMap<>();
for (MachineRecipe recipe : recipes) {
for (ItemStack input : recipe.getInput()) {
for (int slot : getInputSlots()) {
if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(slot), input, true)) {
if (SlimefunUtils.isItemSimilar(inventory.get(slot), input, true)) {
found.put(slot, input.getAmount());
break;
}
}
}
if (found.size() == recipe.getInput().length) {
r = recipe;
break;
}
else {
found.clear();
}
}
if (r != null) {
if (!InvUtils.fitAll(inv.toInventory(), r.getOutput(), getOutputSlots())) {
return;
if (found.size() == recipe.getInput().length) {
if (!InvUtils.fitAll(inv.toInventory(), recipe.getOutput(), getOutputSlots())) {
return null;
}
for (Map.Entry<Integer, Integer> entry : found.entrySet()) {
inv.consumeItem(entry.getKey(), entry.getValue());
}
processing.put(b, r);
progress.put(b, r.getTicks());
return recipe;
}
else {
found.clear();
}
}
return null;
}
}

View File

@ -18,6 +18,7 @@ options:
enable-translations: true
log-duplicate-block-entries: true
burn-players-when-radioactive: true
drop-excess-sf-give-items: false
guide:
default-view-book: false

View File

@ -1,240 +1,149 @@
---
android:
scripts:
already-uploaded: "&4Tento script byl již nahrán."
editor: Editor skriptu
enter-name:
-
- "&eProsíme, zadejte název vašeho scriptu"
instructions:
ATTACK_ANIMALS: "&4Útoč na &czvířata"
ATTACK_ANIMALS_ADULT: "&4Útoč na &czvířata&7[Dospělá]"
ATTACK_MOBS: "&4Útoč na &cnepřátelské moby"
ATTACK_MOBS_ANIMALS: "&4Útoč na &cnepřátelské moby a zvířata"
CATCH_FISH: "&bRybař"
CHOP_TREE: "&cPokácej a zasaď"
DIG_DOWN: "&bKopej dolů"
DIG_FORWARD: "&bKopej dopředu"
DIG_UP: "&bKopej nahoru"
FARM_DOWN: "&bSkliď a zasaď &7(Blok pod)"
FARM_EXOTIC_DOWN: "&bSkliď a zasaď &7(Blok pod + Pokročilé)"
FARM_EXOTIC_FORWARD: "&bSkliď a zasaď &7(Pokročilé)"
FARM_FORWARD: "&bSkliď a zasaď"
GO_DOWN: "&7Posuň se dolů"
GO_FORWARD: "&7Posuň se vpřed"
GO_UP: "&7Posuň se nahoru"
INTERFACE_FUEL: "&cVyndej palivo z rozhraní přední strany"
INTERFACE_ITEMS: "&9Přesuň obsah inventáře do rozhraní na přední straně"
MOVE_AND_DIG_DOWN: "&bPosuň se a zároveň kopej dolů"
MOVE_AND_DIG_FORWARD: "&bPosuň se a zároveň kopej dopředu"
MOVE_AND_DIG_UP: "&bPosuň se a zároveň kopej nahoru"
REPEAT: "&9Opakovat Script"
START: "&2Začít Script"
TURN_LEFT: "&7Otoč se doleva"
TURN_RIGHT: "&7Otoč se doprava"
WAIT: "&ePočkej 0.5s"
rating:
already: "&4K tomuto scriptu jsi již zanechal hlasování!"
own: "&4Nemůžeš hodnotit vlastní script!"
uploaded:
- "&bNahrávání..."
- "&aTvůj script byl úspěšně nahrán!"
started: "&7Tvůj Android právě začal používat jemu přidělený script"
stopped: "&7Tvůj Android pozastavil jemu přidělený script"
backpack:
already-open: "&cOmlouváme se, tento batoh je otevřený již někde jinde!"
no-stack: "&cNemůžeš stackovat batohy"
commands:
help: Zobrazí tuto nápovědu
cheat: Umožňuje nacheatovat věci
give: Dejte někomu nějaké Slimefun věci
guide: Dá vám Slimefun příručku
help: Zobrazí tuto nápovědu
timings: Lag-Info vašeho serveru
teleporter: "Zobrazí \nznačky \nostatních hráčů"
versions: Seznam všech nainstalovaných doplňků
search: Vyhledá ve vaší příručce daný příkaz
open_guide: Otevře Slimefun příručku bez použití knihy
stats: Ukáže statistiky hráče
research:
description: Odemkne/Resetuje výzkum daného hráče
reset: "&cResetoval jsi výzkum hráče %player%"
reset-target: "&cTvoje znalost byla resetována "
search: Vyhledá ve vaší příručce daný příkaz
stats: Ukáže statistiky hráče
teleporter: "Zobrazí \nznačky \nostatních hráčů"
timings: Lag-Info vašeho serveru
versions: Seznam všech nainstalovaných doplňků
backpack:
player-never-joined: "&4Hráče s tímto jménem nelze nalézt!"
description: Načíst kopii existujícího batohu
invalid-id: "&4Id nesmí být záporné!"
player-never-joined: "&4Hráče s tímto jménem nelze nalézt!"
backpack-does-not-exist: "&4Určený batoh neexistuje!"
restored-backpack-given: "&aTvůj batoh byl obnoven a navrácen do tvého inventáře!"
gps:
geo:
scan-required: "&4GEO-Scan je požadován! &cProzkoumejte tento chunk pomocí GEO-Scanneru!"
insufficient-complexity:
- "&4Nedostatečná komplexita GPS Networku: &c%complexity%"
- "&4a) Nemáš nastavený GPS Network"
- "&4b) TvůjGPS Network není dostatečně komplexní"
waypoint:
added: "&aÚspěšně přidán nový waypoint"
max: "&4Dosáhl jsi maxima waypointů"
new: "&eProsím, zadejte název waypointu do chatu. &7(Barvy jsou podporovány!)"
deathpoint: "&4Bod úmrtí &7%date%"
guide:
back:
guide: Zpět do Slimefun Guide
settings: Zpět do Settings Panel
title: Zpět
search:
message: "&bCo bys chtěl vyhledat?"
name: "&7Hledat..."
tooltip: "&bKliknutím vyhledejte položku"
inventory: 'Hledání: %item%'
lore:
- "&bCo bys chtěl vyhledat?"
- "&7Napiš do chatu co chceš vyhledat"
cheat:
no-multiblocks: "&4Nemůžeš podvádět v multiblocích, musíš je postavit!"
languages:
updated: "&aTvůj jazyk byl úspěšně nastaven na: &b%lang%"
translations:
name: "&aChybí zde něco?"
lore: Klikni pro přidání vlastního překladu
select: Klikni pro vybrání jazyka
select-default: Klikni pro vybrání výchozího jazyka
selected-language: 'Aktuálně vybráno:'
change: Klikni pro výběr nového jazyka
description:
- "&7Nyní máš možnost to změnit"
- "&7jazyk, ve kterém bude Slimefun"
- "&7bude ti představeno. Předměty"
- "&7nelze prozatím přeložit."
title:
main: Slimefun příručka
settings: Nastavení a informace
languages: Zvol tvůj preferovaný jazyk
credits: Slimefun4 pomocníci
wiki: Slimefun4 Wiki
addons: Addony pro Slimefun4
bugs: Nahlášení chyb
source: Zdrojový kód
versions: Nainstalovaná verze
credits:
commits: Commits
profile-link: Klikni pro navštívení jejich profilu na GitHubu
roles:
developer: "&6Vývojář"
wiki: "&3Wiki správce"
resourcepack: "&cTvůrce Resourcepacku"
translator: "&9Překladač"
wiki: "&3Wiki správce"
languages:
select: Klikni pro vybrání jazyka
selected-language: 'Aktuálně vybráno:'
translations:
lore: Klikni pro přidání vlastního překladu
name: "&aChybí zde něco?"
updated: "&aTvůj jazyk byl úspěšně nastaven na: &b%lang%"
select-default: Klikni pro vybrání výchozího jazyka
profile-link: Klikni pro navštívení jejich profilu na GitHubu
open: Klikni pro zobrazení našich spoluúčastníků
description:
- "&7Slimefun je open-source projekt"
- "&7a udržován velkou komunitou lidí."
- "&Přes&e%contributors% &7lidí na tom pracovalo"
- "&7Slimefun za všechny ty roky."
pages:
previous: Předchozí strana
next: Následující strana
tooltips:
open-category: Klikni pro otevření
versions-notice: To jsou velmi důležité při hlášení chyb!
wiki: Zobrazit tento předmět na oficiální SlimeFun Wiki
recipes:
machine: Recepty vytvářené tímto strojem
miner: Materiály, které můžeš získat tímto těžebním robotem
generator: Dostupné typy paliv
gold-pan: Materiály, které můžeš získat
back:
title: Zpět
guide: Zpět do Slimefun Guide
settings: Zpět do Settings Panel
locked: ZAMČENO
locked-category:
- Chcete-li odemknout tuto kategorii, budete
- 'je třeba odemknout všechny položky z '
- následující kategorie
pages:
next: Následující strana
previous: Předchozí strana
search:
inventory: 'Hledání: %item%'
lore:
- "&bCo bys chtěl vyhledat?"
- "&7Napiš do chatu co chceš vyhledat"
message: "&bCo bys chtěl vyhledat?"
name: "&7Hledat..."
tooltip: "&bKliknutím vyhledejte položku"
title:
addons: Addony pro Slimefun4
bugs: Nahlášení chyb
credits: Slimefun4 pomocníci
main: Slimefun příručka
settings: Nastavení a informace
source: Zdrojový kód
wiki: Slimefun4 Wiki
languages: Zvol tvůj preferovaný jazyk
tooltips:
open-category: Klikni pro otevření
recipes:
generator: Dostupné typy paliv
gold-pan: Materiály, které můžeš získat
machine: Recepty vytvářené tímto strojem
miner: Materiály, které můžeš získat tímto těžebním robotem
wiki: Zobrazit tento předmět na oficiální SlimeFun Wiki
versions-notice: To jsou velmi důležité při hlášení chyb!
inventory:
no-access: "&4Nemáš přístup k tomuto bloku"
languages:
af: Afrikánština
ar: Arabština
bg: Bulharština
cs: Čeština
da: Dánština
de: Němčina
el: Řečtina
en: Angličtina
es: Španělština
fa: Perština
fi: Finština
fr: Francouzština
he: Hebrejština
hu: Maďarština
id: Indonéština
it: Italština
ja: Japonština
ko: Korejština
lv: Lotyština
ms: Malajština
nl: Holandština
'no': Norština
pl: Polština
pt: Portugalština (Portugalsko)
pt-BR: Portugalština (Brazílie)
ro: Rumunština
ru: Ruština
sk: Slovenština
sv: Švédština
th: Thajština
tr: Turečtina
uk: Ukrajinština
vi: Vietnamština
zh-CN: Čínština (Čína)
zh-TW: Čínština (Taiwan)
hr: Chorvatština
sr: Srbština
be: Běloruština
mk: Makedonština
machines:
ANCIENT_ALTAR:
not-enough-pedestals: "&4Altáři chybí podstavce &c(%pedestals% / 8)"
unknown-catalyst: "&4Neznámý katalyst. &cPoužij správný recept!"
unknown-recipe: "&4Neznámý recept! &cPoužij správný recept!"
CARGO_NODES:
must-be-placed: "&4Musí být umístěn na truhlu nebo stroj!"
ELEVATOR:
click-to-teleport: "&eKliknutím &7se teleportuješ na toto patro:"
current-floor: "&eAktuální patro:"
enter-name: "&7Prosím, zadejte název podlaží do chatu. &r(Barvy jsou podporovány!)"
named: "&2Podlaží úspěšně pojmenováno na: &r%floor%"
no-destinations: "&4Žádné destinace nebyly nalezeny"
pick-a-floor: "&3- Vyber si patro -"
full-inventory: "&eOmlouvám se, můj inventář je plný."
GPS_CONTROL_PANEL:
title: GPS - Kontrolní panel
transmitters: Přehled vysílačů
waypoints: Přehled waypointů
HOLOGRAM_PROJECTOR:
enter-text: "&7Napiš do chatu zprávu, kterou chceš, aby Hologram ukazoval. &r(Barvy
jsou podporovány!)"
inventory-title: Editor hologramu
in-use: "&cInventář tohoto bloku je právě otevřen jiným hráčem"
pattern-not-found: "&eOmlouvám se, ale nerozpoznal jsem tento recept. Dej do dispenseru
předměty tak, aby odpovídaly receptu."
TELEPORTER:
cancelled: "&4Teleportace zrušena!"
gui:
time: Předpokládaný čas
title: Vaše waypointy
tooltip: Klikněte pro teleportaci
invulnerability: "&b&lZískal jsi 30 sekund nezranitelnosti!"
teleported: "&3Teleportace dokončena!"
teleporting: "&3Teleportuji..."
unknown-material: "&eOmlouvám se, ale nepoznal jsem předmět v dispenseru. Dej tam
něco, co znám."
wrong-item: "&eOmlouvám se, ale nerozpoznal jsem předmět, se kterým jsi na mě kliknul.
Zkontroluj recept a koukni se, jaké předměty můžeš použít."
ignition-chamber-no-flint: "&cIgnition Chamberu chybí křesadlo."
ANCIENT_PEDESTAL:
obstructed: "&4Podstavce jsou zablokované! &cOdstraň cokoliv nad podstavcema!"
INDUSTRIAL_MINER:
no-fuel: "&cTvému průmyslovému horníku došlo palivo! Vložte palivo do bedny nad."
piston-facing: "&cTvůj průmyslový horník potřebuje píst směřující nahoru!"
piston-space: "&cDva písty potřebují prázdný blok nad nimi!"
destroyed: "&cZdá se, váš průmysloví horník byl rozbit."
already-running: "&cTento průmyslový horník již běží!"
full-chest: "&cBedna vašeho průmyslového horníka je plná!"
no-permission: "&4Zdá se, nemáte oprávnění používat průmyslového horníka zde!"
finished: "&eVáš průmysloví horník dokončil práci! Získal %ores% hornin!"
work-in-progress: Tato funkce ještě není zcela dokončena!
messages:
cannot-place: "&cZde nemůžeš položit blok!"
diet-cookie: "&eZačínáš se cítit velice lehký..."
not-researched: "&4Ještě jsi nepostoupil tak daleko, abys pochopil tuhle věc"
not-enough-xp: "&4Nemáš dostatek XP levelů na to, abys vyzkoumal tuhle věc"
unlocked: '&bMáš vyzkoumáno &7"%research%"'
only-players: "&4Tenhle příkaz je jenom pro hráče"
unknown-player: "&4Neznámý hráč: &c%player%"
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!"
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!"
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á"
disabled-item: |-
&4&lTahle věc není povolená!
Jak jsi ji vůbec dostal?
no-tome-yourself: "&cNemůžeš použít svůj &4Tome of Knowledge &c..."
multimeter: "&bEnergie: &3%stored% &b/ &3%capacity%"
talisman:
anvil: "&a&oTvůj talisman zachránil tvůj nástroj od rozbití"
miner: "&a&oTvůj talisman zdvojnásobil tvoje dropy"
hunter: "&a&oTvůj talisman zdvojnásobil tvoje dropy"
lava: "&a&oTvůj talisman tě zachránil před uhořením"
water: "&a&oTvůj talisman tě zachránil před utopením"
angel: "&a&oTvůj talisman tě zachránil před poškození pádem"
fire: "&a&oTvůj talisman tě zachránil před uhořením"
magician: "&a&oTvůj talisman ti dal přídavné enchanty"
traveller: "&a&oTvůj talisman ti dal rychlost"
warrior: "&a&oTvůj talisman ti dal efekt síly na nějakou tu chvíli"
knight: "&a&oTvůj talisman ti dal 5 vteřin regenerace"
whirlwind: "&a&oTvůj talisman odrazil projektil"
wizard: "&a&oTvůj talisman ti dal větší level Štěstí, ale možná snížil level jiných
enchantů"
soulbound-rune:
fail: "&cKe své duši můžeš přidat jen jeden předmět."
success: "&aÚspěšně jsi přidal tento item ke své duši. Pokud zemřeš, item ti zůstane."
research:
start: "&7Antičtí duchové šeptají magické slova do tvého ucha..."
progress: "&7Začal jsi přemýšlet nad &b%research% &e(%progress%)"
fire-extinguish: "&7Uhasil ses"
cannot-place: "&cZde nemůžeš položit blok!"
no-pvp: "&cZde nemůžeš bojovat s hráči!"
radiation: "&4Byl jsi vystaven smrtelné radiaci! &cVyhoď radioaktivní předmět nebo
si obleč Hazmat oblek."
opening-guide: "&bOtevírání příručky, může to pár sekund trvat..."
opening-backpack: "&bOtevírání batohu, může to pár sekund trvat..."
no-iron-golem-heal: "&cTo není Iron Ingot! S tímto nemůžeš léčit Iron Golemy!"
link-prompt: "&eKlikni zde:"
diet-cookie: "&eZačínáš se cítit velice lehký..."
fortune-cookie:
- "&7POMOOC!! Jsem uvězněn v továrně na sušenky štěstí!"
- "&7Zítra zemřeš... s láskou od pana Creepera"
@ -247,55 +156,183 @@ messages:
- "&742. Odpověď je 42."
- "&7Walshy udrží den problémy pryč."
- "&7Nikdy nekopej pod sebe!"
give-item: '&bDal jsi %player% &a%amount% &7"%item%&7"'
given-item: '&bDostal jsi &a%amount% &7"%item%&7"'
give-research: '&bUdělil jsi %player% výzkum &7"%research%&7"'
hungry: "&cJsi moc hladový na to, abys to zvládl!"
link-prompt: "&eKlikni zde:"
- "&7To je jen rána masa!"
- "&7Vždy se podívejte na světlou stránku života!"
- "&7Tohle byl vlastně Biscuit a ne Cookie"
- "&7Neonové cedule jsou LIT!"
piglin-barter: "&4Nemůžete měnit s pigliny Slimefun předměty"
enchantment-rune:
fail: "&cNemůžeš enchantovat tento předmět"
no-enchantment: "&cPro tento předmět nelze najít žádný vhodný enchant."
success: "&aÚspěšně jsi na tento předmět daů náhodný enchant."
tape-measure:
no-anchor: "&cMusíš nastavit kotvu než začneš měřit! "
wrong-world: "&cTvoje kotva je pravděpodobně v jiném světa!"
distance: "&7Měření zahájeno. &eVzdálenost: %distance%"
anchor-set: "&aÚspěšně nastavena kotva:&e %anchor%"
multi-tool:
mode-change: "&b%device% mód změněn na: &9%mode%"
multimeter: "&bEnergie: &3%stored% &b/ &3%capacity%"
no-iron-golem-heal: "&cTo není Iron Ingot! S tímto nemůžeš léčit Iron Golemy!"
no-permission: "&4Na tohle nemáš dostatečné povolení"
no-pvp: "&cZde nemůžeš bojovat s hráči!"
not-enough-xp: "&4Nemáš dostatek XP levelů na to, abys vyzkoumal tuhle věc"
no-tome-yourself: "&cNemůžeš použít svůj &4Tome of Knowledge &c..."
not-online: "&4%player% &czrovna není připojen!"
not-researched: "&4Ještě jsi nepostoupil tak daleko, abys pochopil tuhle věc"
not-valid-amount: "&4%amount% &cnení platné číslo : musí být větší než 0!"
not-valid-item: "&4%item% &cnení platný item!"
not-valid-research: "&4%research% &cnení platný výzkum!"
only-players: "&4Tenhle příkaz je jenom pro hráče"
opening-backpack: "&bOtevírání batohu, může to pár sekund trvat..."
opening-guide: "&bOtevírání příručky, může to pár sekund trvat..."
radiation: "&4Byl jsi vystaven smrtelné radiaci! &cVyhoď radioaktivní předmět nebo
si obleč Hazmat oblek."
research:
progress: "&7Začal jsi přemýšlet nad &b%research% &e(%progress%)"
start: "&7Antičtí duchové šeptají magické slova do tvého ucha..."
soulbound-rune:
fail: "&cKe své duši můžeš přidat jen jeden předmět."
success: "&aÚspěšně jsi přidal tento item ke své duši. Pokud zemřeš, item ti zůstane."
talisman:
angel: "&a&oTvůj talisman tě zachránil před poškození pádem"
anvil: "&a&oTvůj talisman zachránil tvůj nástroj od rozbití"
fire: "&a&oTvůj talisman tě zachránil před uhořením"
hunter: "&a&oTvůj talisman zdvojnásobil tvoje dropy"
knight: "&a&oTvůj talisman ti dal 5 vteřin regenerace"
lava: "&a&oTvůj talisman tě zachránil před uhořením"
magician: "&a&oTvůj talisman ti dal přídavné enchanty"
miner: "&a&oTvůj talisman zdvojnásobil tvoje dropy"
traveller: "&a&oTvůj talisman ti dal rychlost"
warrior: "&a&oTvůj talisman ti dal efekt síly na nějakou tu chvíli"
water: "&a&oTvůj talisman tě zachránil před utopením"
whirlwind: "&a&oTvůj talisman odrazil projektil"
wizard: "&a&oTvůj talisman ti dal větší level Štěstí, ale možná snížil level jiných
enchantů"
unknown-player: "&4Neznámý hráč: &c%player%"
unlocked: '&bMáš vyzkoumáno &7"%research%"'
usage: "&4Použití: &c%usage%"
miner:
no-ores: "&eOmlouvám se, nemohu najít rudy v okolí!"
workbench:
not-enhanced: "&4Nemůžeš použít itemy ze Slimefunu v normální výrobě"
not-shears: "&cMulti Tool nemůže být použit jako nůžky!"
mode-change: "&b%device% mód změněn na: &9%mode%"
machines:
pattern-not-found: "&eOmlouvám se, ale nerozpoznal jsem tento recept. Dej do dispenseru
předměty tak, aby odpovídaly receptu."
unknown-material: "&eOmlouvám se, ale nepoznal jsem předmět v dispenseru. Dej tam
něco, co znám."
wrong-item: "&eOmlouvám se, ale nerozpoznal jsem předmět, se kterým jsi na mě kliknul.
Zkontroluj recept a koukni se, jaké předměty můžeš použít."
full-inventory: "&eOmlouvám se, můj inventář je plný."
in-use: "&cInventář tohoto bloku je právě otevřen jiným hráčem"
ignition-chamber-no-flint: "&cIgnition Chamberu chybí křesadlo."
ANCIENT_ALTAR:
not-enough-pedestals: "&4Altáři chybí podstavce &c(%pedestals% / 8)"
unknown-catalyst: "&4Neznámý katalyst. &cPoužij správný recept!"
unknown-recipe: "&4Neznámý recept! &cPoužij správný recept!"
ANCIENT_PEDESTAL:
obstructed: "&4Podstavce jsou zablokované! &cOdstraň cokoliv nad podstavcema!"
HOLOGRAM_PROJECTOR:
enter-text: "&7Napiš do chatu zprávu, kterou chceš, aby Hologram ukazoval. &r(Barvy
jsou podporovány!)"
inventory-title: Editor hologramu
ELEVATOR:
no-destinations: "&4Žádné destinace nebyly nalezeny"
pick-a-floor: "&3- Vyber si patro -"
current-floor: "&eAktuální patro:"
click-to-teleport: "&eKliknutím &7se teleportuješ na toto patro:"
enter-name: "&7Prosím, zadejte název podlaží do chatu. &r(Barvy jsou podporovány!)"
named: "&2Podlaží úspěšně pojmenováno na: &r%floor%"
TELEPORTER:
teleporting: "&3Teleportuji..."
teleported: "&3Teleportace dokončena!"
cancelled: "&4Teleportace zrušena!"
invulnerability: "&b&lZískal jsi 30 sekund nezranitelnosti!"
gui:
title: Vaše waypointy
tooltip: Klikněte pro teleportaci
time: Předpokládaný čas
CARGO_NODES:
must-be-placed: "&4Musí být umístěn na truhlu nebo stroj!"
GPS_CONTROL_PANEL:
title: GPS - Kontrolní panel
transmitters: Přehled vysílačů
waypoints: Přehled waypointů
INDUSTRIAL_MINER:
no-fuel: "&cTvému průmyslovému horníku došlo palivo! Vložte palivo do bedny nad."
piston-facing: "&cTvůj průmyslový horník potřebuje píst směřující nahoru!"
piston-space: "&cDva písty potřebují prázdný blok nad nimi!"
destroyed: "&cZdá se, váš průmysloví horník byl rozbit."
already-running: "&cTento průmyslový horník již běží!"
full-chest: "&cBedna vašeho průmyslového horníka je plná!"
no-permission: "&4Zdá se, nemáte oprávnění používat průmyslového horníka zde!"
finished: "&eVáš průmysloví horník dokončil práci! Získal %ores% hornin!"
anvil:
not-working: "&4Předměty ze Slimefunu nelze použít v kovadlině!"
backpack:
already-open: "&cOmlouváme se, tento batoh je otevřený již někde jinde!"
no-stack: "&cNemůžeš stackovat batohy"
workbench:
not-enhanced: "&4Nemůžeš použít itemy ze Slimefunu v normální výrobě"
gps:
deathpoint: "&4Bod úmrtí &7%date%"
waypoint:
new: "&eProsím, zadejte název waypointu do chatu. &7(Barvy jsou podporovány!)"
added: "&aÚspěšně přidán nový waypoint"
max: "&4Dosáhl jsi maxima waypointů"
duplicate: "&4Již jsi vytvořil waypoint pojmenovaný: &f%waypoint%"
insufficient-complexity:
- "&4Nedostatečná komplexita GPS Networku: &c%complexity%"
- "&4a) Nemáš nastavený GPS Network"
- "&4b) TvůjGPS Network není dostatečně komplexní"
geo:
scan-required: "&4GEO-Scan je požadován! &cProzkoumejte tento chunk pomocí GEO-Scanneru!"
inventory:
no-access: "&4Nemáš přístup k tomuto bloku"
android:
started: "&7Tvůj Android právě začal používat jemu přidělený script"
stopped: "&7Tvůj Android pozastavil jemu přidělený script"
scripts:
already-uploaded: "&4Tento script byl již nahrán."
instructions:
START: "&2Začít Script"
REPEAT: "&9Opakovat Script"
WAIT: "&ePočkej 0.5s"
GO_FORWARD: "&7Posuň se vpřed"
GO_UP: "&7Posuň se nahoru"
GO_DOWN: "&7Posuň se dolů"
TURN_LEFT: "&7Otoč se doleva"
TURN_RIGHT: "&7Otoč se doprava"
DIG_UP: "&bKopej nahoru"
DIG_FORWARD: "&bKopej dopředu"
DIG_DOWN: "&bKopej dolů"
MOVE_AND_DIG_UP: "&bPosuň se a zároveň kopej nahoru"
MOVE_AND_DIG_FORWARD: "&bPosuň se a zároveň kopej dopředu"
MOVE_AND_DIG_DOWN: "&bPosuň se a zároveň kopej dolů"
ATTACK_MOBS_ANIMALS: "&4Útoč na &cnepřátelské moby a zvířata"
ATTACK_MOBS: "&4Útoč na &cnepřátelské moby"
ATTACK_ANIMALS: "&4Útoč na &czvířata"
ATTACK_ANIMALS_ADULT: "&4Útoč na &czvířata&7[Dospělá]"
CHOP_TREE: "&cPokácej a zasaď"
CATCH_FISH: "&bRybař"
FARM_FORWARD: "&bSkliď a zasaď"
FARM_DOWN: "&bSkliď a zasaď &7(Blok pod)"
FARM_EXOTIC_FORWARD: "&bSkliď a zasaď &7(Pokročilé)"
FARM_EXOTIC_DOWN: "&bSkliď a zasaď &7(Blok pod + Pokročilé)"
INTERFACE_ITEMS: "&9Přesuň obsah inventáře do rozhraní na přední straně"
INTERFACE_FUEL: "&cVyndej palivo z rozhraní přední strany"
enter-name:
-
- "&eProsíme, zadejte název vašeho scriptu"
uploaded:
- "&bNahrávání..."
- "&aTvůj script byl úspěšně nahrán!"
rating:
own: "&4Nemůžeš hodnotit vlastní script!"
already: "&4K tomuto scriptu jsi již zanechal hlasování!"
editor: Editor skriptu
languages:
default: Výchozí-serverový
en: Angličtina
de: Němčina
fr: Francouzština
it: Italština
es: Španělština
pl: Polština
sv: Švédština
nl: Holandština
cs: Čeština
hu: Maďarština
lv: Lotyština
ru: Ruština
sk: Slovenština
zh-TW: Čínština (Taiwan)
vi: Vietnamština
id: Indonéština
zh-CN: Čínština (Čína)
el: Řečtina
he: Hebrejština
pt: Portugalština (Portugalsko)
pt-BR: Portugalština (Brazílie)
ar: Arabština
af: Afrikánština
da: Dánština
fi: Finština
uk: Ukrajinština
ms: Malajština
'no': Norština
ja: Japonština
fa: Perština
th: Thajština
ro: Rumunština
bg: Bulharština
ko: Korejština
tr: Turečtina
hr: Chorvatština
mk: Makedonština
sr: Srbština
be: Běloruština
brewing_stand:
not-working: "&4Nemůžeš používat Slimefun předměty ve varném stojanu!"
villagers:
no-trading: "&4Nemůžeš měnit Slimefun předměty s vesničany!"
miner:
no-ores: "&eOmlouvám se, nemohu najít rudy v okolí!"

View File

@ -5,6 +5,7 @@ import org.bukkit.entity.Player;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import be.seeseemelk.mockbukkit.MockBukkit;
@ -14,7 +15,7 @@ import io.github.thebusybiscuit.slimefun4.core.researching.Research;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.testing.TestUtilities;
public class TestResearchCommand {
class TestResearchCommand {
private static ServerMock server;
@ -39,7 +40,8 @@ public class TestResearchCommand {
}
@Test
public void testResearchAll() throws InterruptedException {
@DisplayName("Test /sf research all")
void testResearchAll() throws InterruptedException {
SlimefunPlugin.getRegistry().setResearchingEnabled(true);
Player player = server.addPlayer();
PlayerProfile profile = TestUtilities.awaitProfile(player);
@ -51,7 +53,8 @@ public class TestResearchCommand {
}
@Test
public void testResearchSpecific() throws InterruptedException {
@DisplayName("Test /sf research <research id>")
void testResearchSpecific() throws InterruptedException {
SlimefunPlugin.getRegistry().setResearchingEnabled(true);
Player player = server.addPlayer();
PlayerProfile profile = TestUtilities.awaitProfile(player);
@ -63,7 +66,8 @@ public class TestResearchCommand {
}
@Test
public void testResearchReset() throws InterruptedException {
@DisplayName("Test /sf research reset")
void testResearchReset() throws InterruptedException {
SlimefunPlugin.getRegistry().setResearchingEnabled(true);
Player player = server.addPlayer();
PlayerProfile profile = TestUtilities.awaitProfile(player);

View File

@ -8,6 +8,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
@ -22,7 +23,7 @@ import io.github.thebusybiscuit.slimefun4.testing.TestUtilities;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
public class TestGuideOpening {
class TestGuideOpening {
private static ServerMock server;
private static SlimefunPlugin plugin;
@ -48,14 +49,16 @@ public class TestGuideOpening {
}
@Test
public void testOpenMainMenu() throws InterruptedException {
@DisplayName("Test if the Slimefun Guide Main Menu can be opened from the History")
void testOpenMainMenu() throws InterruptedException {
SlimefunGuideImplementation guide = Mockito.mock(SlimefunGuideImplementation.class);
PlayerProfile profile = prepare(guide, history -> {});
Mockito.verify(guide).openMainMenu(profile, 1);
}
@Test
public void testOpenCategory() throws InterruptedException {
@DisplayName("Test if a Category can be opened from the History")
void testOpenCategory() throws InterruptedException {
Category category = new Category(new NamespacedKey(plugin, "history_category"), new CustomItem(Material.BLUE_TERRACOTTA, "&9Testy test"));
SlimefunGuideImplementation guide = Mockito.mock(SlimefunGuideImplementation.class);
@ -64,7 +67,8 @@ public class TestGuideOpening {
}
@Test
public void testOpenSlimefunItem() throws InterruptedException {
@DisplayName("Test if a SlimefunItem can be viewed from the History")
void testOpenSlimefunItem() throws InterruptedException {
SlimefunItem item = TestUtilities.mockSlimefunItem(plugin, "OPEN_SLIMEFUN_ITEM", new CustomItem(Material.PRISMARINE_SHARD, "&5Some Shard I guess"));
SlimefunGuideImplementation guide = Mockito.mock(SlimefunGuideImplementation.class);
@ -73,7 +77,8 @@ public class TestGuideOpening {
}
@Test
public void testOpenItemStack() throws InterruptedException {
@DisplayName("Test if an ItemStack can be viewed from the History")
void testOpenItemStack() throws InterruptedException {
ItemStack item = new ItemStack(Material.REDSTONE_BLOCK);
SlimefunGuideImplementation guide = Mockito.mock(SlimefunGuideImplementation.class);
@ -82,7 +87,8 @@ public class TestGuideOpening {
}
@Test
public void testOpenSearch() throws InterruptedException {
@DisplayName("Test if the Slimefun Search can be opened from the History")
void testOpenSearch() throws InterruptedException {
String query = "electric";
SlimefunGuideImplementation guide = Mockito.mock(SlimefunGuideImplementation.class);
@ -91,7 +97,8 @@ public class TestGuideOpening {
}
@Test
public void testGoBack() throws InterruptedException {
@DisplayName("Test if the Back button works")
void testGoBack() throws InterruptedException {
Player player = server.addPlayer();
String query = "electric";

View File

@ -10,6 +10,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@ -24,7 +25,7 @@ import io.github.thebusybiscuit.slimefun4.testing.TestUtilities;
import me.mrCookieSlime.Slimefun.Objects.Category;
@TestMethodOrder(value = OrderAnnotation.class)
public class TestItemSetup {
class TestItemSetup {
private static SlimefunPlugin plugin;
@ -42,7 +43,8 @@ public class TestItemSetup {
@Test
@Order(value = 1)
public void testForExceptions() {
@DisplayName("Test whether SlimefunItemSetup.setup() throws any Exceptions")
void testForExceptions() {
// Not really ideal but still important to test.
// Item amount is variable, so we can't test for that.
// We are really only concerned about any runtime exceptions here.
@ -54,13 +56,15 @@ public class TestItemSetup {
@Test
@Order(value = 2)
public void testWikiSetup() {
@DisplayName("Test whether PostSetup.setupWiki() throws any Exceptions")
void testWikiSetup() {
Assertions.assertDoesNotThrow(() -> PostSetup.setupWiki());
}
@Test
@Order(value = 3)
public void testCategoryTranslations() throws IOException {
@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))) {
FileConfiguration config = YamlConfiguration.loadConfiguration(reader);

View File

@ -4,6 +4,7 @@ import org.bukkit.entity.Player;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import be.seeseemelk.mockbukkit.MockBukkit;
@ -14,7 +15,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.DeathpointListener;
import io.github.thebusybiscuit.slimefun4.testing.TestUtilities;
public class TestDeathpointListener {
class TestDeathpointListener {
private static SlimefunPlugin plugin;
private static ServerMock server;
@ -32,7 +33,8 @@ public class TestDeathpointListener {
}
@Test
public void testNoTransmitter() throws InterruptedException {
@DisplayName("Test Deathpoint not triggering when no Emergency Transmitter is found")
void testNoTransmitter() throws InterruptedException {
Player player = server.addPlayer();
TestUtilities.awaitProfile(player);
@ -41,7 +43,8 @@ public class TestDeathpointListener {
}
@Test
public void testTransmitter() throws InterruptedException {
@DisplayName("Test Emergency Transmitter creating a new Waypoint")
void testTransmitter() throws InterruptedException {
Player player = server.addPlayer();
TestUtilities.awaitProfile(player);
player.getInventory().setItem(8, SlimefunItems.GPS_EMERGENCY_TRANSMITTER.clone());

View File

@ -10,6 +10,7 @@ import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
@ -20,7 +21,7 @@ import io.github.thebusybiscuit.slimefun4.core.networks.NetworkManager;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.NetworkListener;
public class TestNetworkListener {
class TestNetworkListener {
private static SlimefunPlugin plugin;
private static NetworkListener listener;
@ -40,7 +41,8 @@ public class TestNetworkListener {
}
@Test
public void testBlockBreak() {
@DisplayName("Test Network updates on Block breaking")
void testBlockBreak() {
World world = server.addSimpleWorld("Simple Network Listener World");
Location l = new Location(world, 3000, 120, -500);
@ -53,7 +55,8 @@ public class TestNetworkListener {
}
@Test
public void testBlockPlace() {
@DisplayName("Test Network updates on Block placing")
void testBlockPlace() {
World world = server.addSimpleWorld("Simple Network Listener World");
Location l = new Location(world, 3000, 120, -500);
Location l2 = new Location(world, 3000, 121, -500);

View File

@ -15,6 +15,7 @@ import org.bukkit.inventory.ShapelessRecipe;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import be.seeseemelk.mockbukkit.MockBukkit;
@ -23,7 +24,7 @@ import io.github.thebusybiscuit.cscorelib2.recipes.RecipeSnapshot;
import io.github.thebusybiscuit.slimefun4.core.services.MinecraftRecipeService;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
public class TestRecipeService {
class TestRecipeService {
private static ServerMock server;
private static SlimefunPlugin plugin;
@ -40,7 +41,8 @@ public class TestRecipeService {
}
@Test
public void testRecipe() {
@DisplayName("Test getting a Minecraft Recipe for an ItemStack result")
void testRecipe() {
MinecraftRecipeService service = new MinecraftRecipeService(plugin);
NamespacedKey key = new NamespacedKey(plugin, "furnace_recipe_test");
@ -59,7 +61,8 @@ public class TestRecipeService {
}
@Test
public void testNoRecipes() {
@DisplayName("Test getting no Minecraft Recipes for uncraftable items or null")
void testNoRecipes() {
MinecraftRecipeService service = new MinecraftRecipeService(plugin);
service.refresh();
@ -68,7 +71,8 @@ public class TestRecipeService {
}
@Test
public void testFurnaceOutput() {
@DisplayName("Test if furnace recipes are handled correctly")
void testFurnaceOutput() {
MinecraftRecipeService service = new MinecraftRecipeService(plugin);
NamespacedKey key = new NamespacedKey(plugin, "furnace_recipe_test2");
@ -95,7 +99,8 @@ public class TestRecipeService {
}
@Test
public void testBigShapedRecipe() {
@DisplayName("Test Shaped Recipes on a 3x3 grid")
void testBigShapedRecipe() {
MinecraftRecipeService service = new MinecraftRecipeService(plugin);
NamespacedKey key = new NamespacedKey(plugin, "shaped_recipe_9");
@ -112,7 +117,8 @@ public class TestRecipeService {
}
@Test
public void testSmallShapedRecipe() {
@DisplayName("Test Shaped Recipes on a 2x2 grid")
void testSmallShapedRecipe() {
MinecraftRecipeService service = new MinecraftRecipeService(plugin);
NamespacedKey key = new NamespacedKey(plugin, "shaped_recipe_4");
@ -129,7 +135,8 @@ public class TestRecipeService {
}
@Test
public void testShapelessRecipeShape() {
@DisplayName("Test shapeless Recipes")
void testShapelessRecipeShape() {
MinecraftRecipeService service = new MinecraftRecipeService(plugin);
Assertions.assertThrows(IllegalArgumentException.class, () -> service.getRecipeShape(null));
@ -146,7 +153,8 @@ public class TestRecipeService {
}
@Test
public void testSubscriptions() {
@DisplayName("Test the Recipe Subscription Service")
void testSubscriptions() {
MinecraftRecipeService service = new MinecraftRecipeService(plugin);
AtomicReference<RecipeSnapshot> reference = new AtomicReference<>();

View File

@ -5,6 +5,7 @@ import java.io.File;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import be.seeseemelk.mockbukkit.MockBukkit;
@ -12,7 +13,7 @@ import io.github.thebusybiscuit.slimefun4.api.SlimefunBranch;
import io.github.thebusybiscuit.slimefun4.core.services.UpdaterService;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
public class TestUpdaterService {
class TestUpdaterService {
private static SlimefunPlugin plugin;
@ -30,7 +31,8 @@ public class TestUpdaterService {
}
@Test
public void testDevelopmentBuilds() {
@DisplayName("Test if the development branch is recognized correctly")
void testDevelopmentBuilds() {
UpdaterService service = new UpdaterService(plugin, "DEV - 131 (git 123456)", file);
Assertions.assertEquals(SlimefunBranch.DEVELOPMENT, service.getBranch());
Assertions.assertTrue(service.getBranch().isOfficial());
@ -39,7 +41,8 @@ public class TestUpdaterService {
}
@Test
public void testStableBuilds() {
@DisplayName("Test if the stable branch is recognized correctly")
void testStableBuilds() {
UpdaterService service = new UpdaterService(plugin, "RC - 6 (git 123456)", file);
Assertions.assertEquals(SlimefunBranch.STABLE, service.getBranch());
Assertions.assertTrue(service.getBranch().isOfficial());
@ -48,7 +51,8 @@ public class TestUpdaterService {
}
@Test
public void testUnofficialBuilds() {
@DisplayName("Test if an unofficial build is recognized correctly")
void testUnofficialBuilds() {
UpdaterService service = new UpdaterService(plugin, "4.20 UNOFFICIAL", file);
Assertions.assertEquals(SlimefunBranch.UNOFFICIAL, service.getBranch());
Assertions.assertFalse(service.getBranch().isOfficial());
@ -56,7 +60,8 @@ public class TestUpdaterService {
}
@Test
public void testUnknownBuilds() {
@DisplayName("Test if unknown builds are caught")
void testUnknownBuilds() {
UpdaterService service = new UpdaterService(plugin, "I am special", file);
Assertions.assertEquals(SlimefunBranch.UNKNOWN, service.getBranch());
Assertions.assertFalse(service.getBranch().isOfficial());