mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
[CI skip] Added an API for Guide Options
This commit is contained in:
parent
03a42ab946
commit
a449b62dba
4
pom.xml
4
pom.xml
@ -7,7 +7,7 @@
|
||||
|
||||
<!-- Our default version will be UNOFFICIAL, this will prevent the auto updater -->
|
||||
<!-- from overriding our local test file -->
|
||||
<version>UNOFFICIAL</version>
|
||||
<version>4.3-UNOFFICIAL</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
@ -208,7 +208,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.thebusybiscuit</groupId>
|
||||
<artifactId>CS-CoreLib2</artifactId>
|
||||
<version>0.10</version>
|
||||
<version>bd12910bdb</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -11,6 +11,12 @@ import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
*
|
||||
*/
|
||||
public enum MinecraftVersion {
|
||||
|
||||
/**
|
||||
* This constant represents Minecraft (Java Edition) Version 1.14
|
||||
* (The Update Aquatic)
|
||||
*/
|
||||
MINECRAFT_1_13("1.13.x"),
|
||||
|
||||
/**
|
||||
* This constant represents Minecraft (Java Edition) Version 1.14
|
||||
|
@ -1,5 +1,7 @@
|
||||
package io.github.thebusybiscuit.slimefun4.api;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.utils.PatternUtils;
|
||||
|
||||
/**
|
||||
* This enum represents the branch this Slimefun build is on.
|
||||
* development or stable, unofficial or even unknown.
|
||||
@ -8,6 +10,11 @@ package io.github.thebusybiscuit.slimefun4.api;
|
||||
*
|
||||
*/
|
||||
public enum SlimefunBranch {
|
||||
|
||||
// It is unbelievable that I have to say this...
|
||||
// DO NOT TRANSLATE THIS FILE. I repeat:
|
||||
// DO NOT TRANSLATE THIS FILE.
|
||||
// You keep messing up our Metrics...
|
||||
|
||||
/**
|
||||
* This build stems from the official "development" branch, it is prefixed with {@code DEV - X}
|
||||
@ -36,6 +43,10 @@ public enum SlimefunBranch {
|
||||
SlimefunBranch(String name, boolean official) {
|
||||
this.name = name;
|
||||
this.official = official;
|
||||
|
||||
if (!PatternUtils.ASCII.matcher(name).matches()) {
|
||||
throw new IllegalStateException("The SlimefunBranch enum contains ILLEGAL CHARACTERS. DO NOT TRANSLATE THIS FILE.");
|
||||
}
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.github.thebusybiscuit.slimefun4.core;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@ -9,7 +10,9 @@ import org.bukkit.Tag;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.BlockFace;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.api.events.MultiBlockInteractEvent;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.MultiBlockMachine;
|
||||
import me.mrCookieSlime.Slimefun.Objects.handlers.MultiBlockInteractionHandler;
|
||||
@ -29,12 +32,17 @@ import me.mrCookieSlime.Slimefun.Objects.handlers.MultiBlockInteractionHandler;
|
||||
*/
|
||||
public class MultiBlock {
|
||||
|
||||
public static final List<Tag<Material>> SUPPORTED_TAGS = Arrays.asList(
|
||||
Tag.LOGS,
|
||||
Tag.WOODEN_TRAPDOORS,
|
||||
Tag.WOODEN_FENCES,
|
||||
Tag.WOODEN_SLABS
|
||||
);
|
||||
public static final List<Tag<Material>> SUPPORTED_TAGS = new ArrayList<>();
|
||||
|
||||
static {
|
||||
SUPPORTED_TAGS.add(Tag.LOGS);
|
||||
SUPPORTED_TAGS.add(Tag.WOODEN_TRAPDOORS);
|
||||
SUPPORTED_TAGS.add(Tag.WOODEN_SLABS);
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
SUPPORTED_TAGS.add(Tag.WOODEN_FENCES);
|
||||
}
|
||||
}
|
||||
|
||||
private final SlimefunItem item;
|
||||
private final Material[] blocks;
|
||||
|
@ -1,9 +1,34 @@
|
||||
package io.github.thebusybiscuit.slimefun4.core.guide;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.inventory.ChestMenu;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
|
||||
/**
|
||||
* This enum holds the different designs a {@link SlimefunGuide} can have.
|
||||
* Each constant corresponds to a {@link SlimefunGuideImplementation}.
|
||||
*
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
* @see SlimefunGuide
|
||||
* @see SlimefunGuideImplementation
|
||||
*
|
||||
*/
|
||||
public enum SlimefunGuideLayout {
|
||||
|
||||
BOOK,
|
||||
CHEST,
|
||||
CHEAT_SHEET;
|
||||
|
||||
/**
|
||||
* This design is a book representation of the {@link SlimefunGuide}
|
||||
*/
|
||||
BOOK,
|
||||
|
||||
/**
|
||||
* This design is the standard layout, it uses a {@link ChestMenu}
|
||||
*/
|
||||
CHEST,
|
||||
|
||||
/**
|
||||
* This is an admin-only design which creates a {@link SlimefunGuide} that allows
|
||||
* you to spawn in any {@link SlimefunItem}
|
||||
*/
|
||||
CHEAT_SHEET;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,57 @@
|
||||
package io.github.thebusybiscuit.slimefun4.core.guide.options;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.data.PersistentDataAPI;
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
|
||||
class OptionFireworks implements SlimefunGuideOption<Boolean> {
|
||||
|
||||
@Override
|
||||
public SlimefunAddon getAddon() {
|
||||
return SlimefunPlugin.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamespacedKey getKey() {
|
||||
return new NamespacedKey(SlimefunPlugin.instance, "research_fireworks");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<ItemStack> getDisplayItem(Player p, ItemStack guide) {
|
||||
if (SlimefunPlugin.getRegistry().isResearchFireworkEnabled()) {
|
||||
boolean enabled = getSelectedOption(p, guide).orElse(true);
|
||||
ItemStack item = new CustomItem(Material.FIREWORK_ROCKET, "&bFireworks: &" + (enabled ? "aYes" : "4No"), "", "&7You can now toggle whether you", "&7will be presented with a big firework", "&7upon researching an item.", "", "&7\u21E8 &eClick to " + (enabled ? "disable" : "enable") + " your fireworks");
|
||||
return Optional.of(item);
|
||||
}
|
||||
else {
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Player p, ItemStack guide) {
|
||||
setSelectedOption(p, guide, !getSelectedOption(p, guide).orElse(true));
|
||||
SlimefunGuideSettings.openSettings(p, guide);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Boolean> getSelectedOption(Player p, ItemStack guide) {
|
||||
NamespacedKey key = getKey();
|
||||
boolean value = !PersistentDataAPI.hasByte(p, key) || PersistentDataAPI.getByte(p, key) == (byte) 1;
|
||||
return Optional.of(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectedOption(Player p, ItemStack guide, Boolean value) {
|
||||
PersistentDataAPI.setByte(p, getKey(), value.booleanValue() ? (byte) 1 : (byte) 0);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,118 @@
|
||||
package io.github.thebusybiscuit.slimefun4.core.guide.options;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
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.slimefun4.api.SlimefunAddon;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideLayout;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
|
||||
class OptionGuideDesign implements SlimefunGuideOption<SlimefunGuideLayout> {
|
||||
|
||||
@Override
|
||||
public SlimefunAddon getAddon() {
|
||||
return SlimefunPlugin.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamespacedKey getKey() {
|
||||
return new NamespacedKey(SlimefunPlugin.instance, "guide_layout");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<ItemStack> getDisplayItem(Player p, ItemStack guide) {
|
||||
Optional<SlimefunGuideLayout> current = getSelectedOption(p, guide);
|
||||
|
||||
if (current.isPresent()) {
|
||||
SlimefunGuideLayout layout = current.get();
|
||||
ItemStack item = new ItemStack(Material.AIR);
|
||||
|
||||
if (layout == SlimefunGuideLayout.CHEST) {
|
||||
item.setType(Material.CHEST);
|
||||
}
|
||||
else if (layout == SlimefunGuideLayout.BOOK) {
|
||||
item.setType(Material.BOOK);
|
||||
}
|
||||
else {
|
||||
item.setType(Material.COMMAND_BLOCK);
|
||||
}
|
||||
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.GRAY + "Slimefun Guide Design: " + ChatColor.YELLOW + ChatUtils.humanize(layout.name()));
|
||||
List<String> lore = new ArrayList<>();
|
||||
lore.add("");
|
||||
lore.add((layout == SlimefunGuideLayout.CHEST ? ChatColor.GREEN : ChatColor.GRAY) + "Chest");
|
||||
lore.add((layout == SlimefunGuideLayout.BOOK ? ChatColor.GREEN : ChatColor.GRAY) + "Book");
|
||||
|
||||
if (p.hasPermission("slimefun.cheat.items")) {
|
||||
lore.add((layout == SlimefunGuideLayout.CHEAT_SHEET ? ChatColor.GREEN : ChatColor.GRAY) + "Cheat Sheet");
|
||||
}
|
||||
|
||||
lore.add("");
|
||||
lore.add(ChatColor.GRAY + "\u21E8 " + ChatColor.YELLOW + "Click to change your layout");
|
||||
meta.setLore(lore);
|
||||
item.setItemMeta(meta);
|
||||
|
||||
return Optional.of(item);
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Player p, ItemStack guide) {
|
||||
Optional<SlimefunGuideLayout> current = getSelectedOption(p, guide);
|
||||
|
||||
if (current.isPresent()) {
|
||||
SlimefunGuideLayout next = getNextLayout(p, current.get());
|
||||
setSelectedOption(p, guide, next);
|
||||
}
|
||||
|
||||
SlimefunGuideSettings.openSettings(p, guide);
|
||||
}
|
||||
|
||||
private SlimefunGuideLayout getNextLayout(Player p, SlimefunGuideLayout layout) {
|
||||
if (p.hasPermission("slimefun.cheat.items")) {
|
||||
if (layout == SlimefunGuideLayout.CHEST) {
|
||||
return SlimefunGuideLayout.BOOK;
|
||||
}
|
||||
|
||||
if (layout == SlimefunGuideLayout.BOOK) {
|
||||
return SlimefunGuideLayout.CHEAT_SHEET;
|
||||
}
|
||||
|
||||
return SlimefunGuideLayout.CHEST;
|
||||
}
|
||||
else {
|
||||
return layout == SlimefunGuideLayout.CHEST ? SlimefunGuideLayout.BOOK : SlimefunGuideLayout.CHEST;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<SlimefunGuideLayout> getSelectedOption(Player p, ItemStack guide) {
|
||||
for (SlimefunGuideLayout layout : SlimefunGuideLayout.values()) {
|
||||
if (SlimefunUtils.isItemSimilar(guide, SlimefunGuide.getItem(layout), true)) {
|
||||
return Optional.of(layout);
|
||||
}
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectedOption(Player p, ItemStack guide, SlimefunGuideLayout value) {
|
||||
guide.setItemMeta(SlimefunGuide.getItem(value).getItemMeta());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,125 @@
|
||||
package io.github.thebusybiscuit.slimefun4.core.guide.options;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.data.PersistentDataAPI;
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.cscorelib2.skull.SkullItem;
|
||||
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
|
||||
import io.github.thebusybiscuit.slimefun4.api.events.PlayerLanguageChangeEvent;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
|
||||
class OptionPlayerLanguages implements SlimefunGuideOption<String> {
|
||||
|
||||
@Override
|
||||
public SlimefunAddon getAddon() {
|
||||
return SlimefunPlugin.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamespacedKey getKey() {
|
||||
return SlimefunPlugin.getLocal().getKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<ItemStack> getDisplayItem(Player p, ItemStack guide) {
|
||||
if (SlimefunPlugin.getLocal().isEnabled()) {
|
||||
Language language = SlimefunPlugin.getLocal().getLanguage(p);
|
||||
String languageName = language.isDefault() ? (SlimefunPlugin.getLocal().getMessage(p, "languages.default") + ChatColor.DARK_GRAY + " (" + language.getName(p) + ")") : SlimefunPlugin.getLocal().getMessage(p, "languages." + language.getId());
|
||||
|
||||
return Optional.of(new CustomItem(language.getItem(), "&7" + SlimefunPlugin.getLocal().getMessage(p, "guide.languages.selected-language") + " &a" + languageName, "", "&7You now have the option to change", "&7the language in which Slimefun", "&7will send you messages.", "&7Note that this only translates", "&7some messages, not items.", "&7&oThis feature is still being worked on", "", "&7\u21E8 &eClick to change your language"));
|
||||
}
|
||||
else {
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Player p, ItemStack guide) {
|
||||
openLanguageSelection(p, guide);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<String> getSelectedOption(Player p, ItemStack guide) {
|
||||
return Optional.of(SlimefunPlugin.getLocal().getLanguage(p).getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectedOption(Player p, ItemStack guide, String value) {
|
||||
if (value == null) {
|
||||
PersistentDataAPI.remove(p, getKey());
|
||||
}
|
||||
else {
|
||||
PersistentDataAPI.setString(p, getKey(), value);
|
||||
}
|
||||
}
|
||||
|
||||
private void openLanguageSelection(Player p, ItemStack guide) {
|
||||
ChestMenu menu = new ChestMenu(SlimefunPlugin.getLocal().getMessage(p, "guide.title.languages"));
|
||||
|
||||
menu.setEmptySlotsClickable(false);
|
||||
menu.addMenuOpeningHandler(pl -> pl.playSound(pl.getLocation(), Sound.BLOCK_NOTE_BLOCK_HARP, 0.7F, 0.7F));
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
if (i == 1) {
|
||||
menu.addItem(1, ChestMenuUtils.getBackButton(p, "", "&7" + SlimefunPlugin.getLocal().getMessage(p, "guide.back.settings")), (pl, slot, item, action) -> {
|
||||
SlimefunGuideSettings.openSettings(pl, guide);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
else if (i == 7) {
|
||||
menu.addItem(7, new CustomItem(SkullItem.fromHash("3edd20be93520949e6ce789dc4f43efaeb28c717ee6bfcbbe02780142f716"), SlimefunPlugin.getLocal().getMessage(p, "guide.languages.translations.name"), "", "&7\u21E8 &e" + SlimefunPlugin.getLocal().getMessage(p, "guide.languages.translations.lore")), (pl, slot, item, action) -> {
|
||||
ChatUtils.sendURL(pl, "https://github.com/TheBusyBiscuit/Slimefun4/wiki/Translating-Slimefun");
|
||||
pl.closeInventory();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
else {
|
||||
menu.addItem(i, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler());
|
||||
}
|
||||
}
|
||||
|
||||
Language defaultLanguage = SlimefunPlugin.getLocal().getDefaultLanguage();
|
||||
String defaultLanguageString = SlimefunPlugin.getLocal().getMessage(p, "languages.default");
|
||||
|
||||
menu.addItem(9, new CustomItem(defaultLanguage.getItem(), ChatColor.GRAY + defaultLanguageString + ChatColor.DARK_GRAY + " (" + defaultLanguage.getName(p) + ")", "", "&7\u21E8 &e" + SlimefunPlugin.getLocal().getMessage(p, "guide.languages.select-default")), (pl, i, item, action) -> {
|
||||
SlimefunPlugin.instance.getServer().getPluginManager().callEvent(new PlayerLanguageChangeEvent(pl, SlimefunPlugin.getLocal().getLanguage(pl), defaultLanguage));
|
||||
setSelectedOption(pl, guide, null);
|
||||
|
||||
SlimefunPlugin.getLocal().sendMessage(pl, "guide.languages.updated", msg -> msg.replace("%lang%", defaultLanguageString));
|
||||
|
||||
SlimefunGuideSettings.openSettings(pl, guide);
|
||||
return false;
|
||||
});
|
||||
|
||||
int slot = 10;
|
||||
|
||||
for (Language language : SlimefunPlugin.getLocal().getLanguages()) {
|
||||
menu.addItem(slot, new CustomItem(language.getItem(), ChatColor.GREEN + language.getName(p), "&b" + SlimefunPlugin.getLocal().getProgress(language) + '%', "", "&7\u21E8 &e" + SlimefunPlugin.getLocal().getMessage(p, "guide.languages.select")), (pl, i, item, action) -> {
|
||||
SlimefunPlugin.instance.getServer().getPluginManager().callEvent(new PlayerLanguageChangeEvent(pl, SlimefunPlugin.getLocal().getLanguage(pl), language));
|
||||
setSelectedOption(pl, guide, language.getId());
|
||||
|
||||
String name = language.getName(pl);
|
||||
SlimefunPlugin.getLocal().sendMessage(pl, "guide.languages.updated", msg -> msg.replace("%lang%", name));
|
||||
|
||||
SlimefunGuideSettings.openSettings(pl, guide);
|
||||
return false;
|
||||
});
|
||||
|
||||
slot++;
|
||||
}
|
||||
|
||||
menu.open(p);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package io.github.thebusybiscuit.slimefun4.core.guide.options;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.bukkit.Keyed;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
|
||||
|
||||
public interface SlimefunGuideOption<T> extends Keyed {
|
||||
|
||||
SlimefunAddon getAddon();
|
||||
|
||||
Optional<ItemStack> getDisplayItem(Player p, ItemStack guide);
|
||||
|
||||
void onClick(Player p, ItemStack guide);
|
||||
|
||||
Optional<T> getSelectedOption(Player p, ItemStack guide);
|
||||
|
||||
void setSelectedOption(Player p, ItemStack guide, T value);
|
||||
|
||||
}
|
@ -1,32 +1,31 @@
|
||||
package io.github.thebusybiscuit.slimefun4.core.guide;
|
||||
package io.github.thebusybiscuit.slimefun4.core.guide.options;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
|
||||
import io.github.thebusybiscuit.cscorelib2.data.PersistentDataAPI;
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.cscorelib2.skull.SkullItem;
|
||||
import io.github.thebusybiscuit.slimefun4.api.events.PlayerLanguageChangeEvent;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideLayout;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.github.Contributor;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.NumberUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.PatternUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
@ -44,11 +43,24 @@ import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
*/
|
||||
public final class SlimefunGuideSettings {
|
||||
|
||||
public static final NamespacedKey FIREWORKS_KEY = new NamespacedKey(SlimefunPlugin.instance, "research_fireworks");
|
||||
private static final int[] BACKGROUND_SLOTS = { 1, 3, 5, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 26, 27, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 50, 52, 53 };
|
||||
private static final List<SlimefunGuideOption<?>> options = new ArrayList<>();
|
||||
|
||||
static {
|
||||
options.add(new OptionGuideDesign());
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
options.add(new OptionFireworks());
|
||||
options.add(new OptionPlayerLanguages());
|
||||
}
|
||||
}
|
||||
|
||||
private SlimefunGuideSettings() {}
|
||||
|
||||
public static <T> void addOption(SlimefunGuideOption<T> option) {
|
||||
options.add(option);
|
||||
}
|
||||
|
||||
public static void openSettings(Player p, ItemStack guide) {
|
||||
ChestMenu menu = new ChestMenu(SlimefunPlugin.getLocal().getMessage(p, "guide.title.settings"));
|
||||
|
||||
@ -64,7 +76,7 @@ public final class SlimefunGuideSettings {
|
||||
}
|
||||
|
||||
private static void addHeader(Player p, ChestMenu menu, ItemStack guide) {
|
||||
menu.addItem(0, new CustomItem(getItem(SlimefunGuideLayout.CHEST), "&e\u21E6 " + SlimefunPlugin.getLocal().getMessage(p, "guide.back.title"), "", "&7" + SlimefunPlugin.getLocal().getMessage(p, "guide.back.guide")), (pl, slot, item, action) -> {
|
||||
menu.addItem(0, new CustomItem(SlimefunGuide.getItem(SlimefunGuideLayout.CHEST), "&e\u21E6 " + SlimefunPlugin.getLocal().getMessage(p, "guide.back.title"), "", "&7" + SlimefunPlugin.getLocal().getMessage(p, "guide.back.guide")), (pl, slot, item, action) -> {
|
||||
SlimefunGuide.openGuide(pl, guide);
|
||||
return false;
|
||||
});
|
||||
@ -110,145 +122,19 @@ public final class SlimefunGuideSettings {
|
||||
private static void addConfigurableOptions(Player p, ChestMenu menu, ItemStack guide) {
|
||||
int i = 19;
|
||||
|
||||
if (SlimefunUtils.isItemSimilar(guide, getItem(SlimefunGuideLayout.CHEST), true)) {
|
||||
if (p.hasPermission("slimefun.cheat.items")) {
|
||||
menu.addItem(i, new CustomItem(Material.CHEST, "&7Guide Layout: &eChest GUI", "", "&aChest GUI", "&7Book GUI", "&7Cheat Sheet", "", "&7\u21E8 &eClick to change your layout"));
|
||||
menu.addMenuClickHandler(i, (pl, slot, item, action) -> {
|
||||
pl.getInventory().setItemInMainHand(getItem(SlimefunGuideLayout.BOOK));
|
||||
openSettings(pl, pl.getInventory().getItemInMainHand());
|
||||
for (SlimefunGuideOption<?> option : options) {
|
||||
Optional<ItemStack> item = option.getDisplayItem(p, guide);
|
||||
|
||||
if (item.isPresent()) {
|
||||
menu.addItem(i, item.get());
|
||||
menu.addMenuClickHandler(i, (pl, slot, stack, action) -> {
|
||||
option.onClick(p, guide);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
else {
|
||||
menu.addItem(i, new CustomItem(Material.CHEST, "&7Guide Layout: &eChest GUI", "", "&aChest GUI", "&7Book GUI", "", "&7\u21E8 &eClick to change your layout"));
|
||||
menu.addMenuClickHandler(i, (pl, slot, item, action) -> {
|
||||
pl.getInventory().setItemInMainHand(getItem(SlimefunGuideLayout.BOOK));
|
||||
openSettings(pl, pl.getInventory().getItemInMainHand());
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
else if (SlimefunUtils.isItemSimilar(guide, getItem(SlimefunGuideLayout.BOOK), true)) {
|
||||
if (p.hasPermission("slimefun.cheat.items")) {
|
||||
menu.addItem(i, new CustomItem(Material.BOOK, "&7Guide Layout: &eBook GUI", "", "&7Chest GUI", "&aBook GUI", "&7Cheat Sheet", "", "&7\u21E8 &eClick to change your layout"));
|
||||
menu.addMenuClickHandler(i, (pl, slot, item, action) -> {
|
||||
pl.getInventory().setItemInMainHand(getItem(SlimefunGuideLayout.CHEAT_SHEET));
|
||||
openSettings(pl, pl.getInventory().getItemInMainHand());
|
||||
return false;
|
||||
});
|
||||
}
|
||||
else {
|
||||
menu.addItem(i, new CustomItem(Material.BOOK, "&7Guide Layout: &eBook GUI", "", "&7Chest GUI", "&aBook GUI", "", "&7\u21E8 &eClick to change your layout"));
|
||||
menu.addMenuClickHandler(i, (pl, slot, item, action) -> {
|
||||
pl.getInventory().setItemInMainHand(getItem(SlimefunGuideLayout.CHEST));
|
||||
openSettings(pl, pl.getInventory().getItemInMainHand());
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
else if (SlimefunUtils.isItemSimilar(guide, getItem(SlimefunGuideLayout.CHEAT_SHEET), true)) {
|
||||
menu.addItem(i, new CustomItem(Material.COMMAND_BLOCK, "&7Guide Layout: &eCheat Sheet", "", "&7Chest GUI", "&7Book GUI", "&aCheat Sheet", "", "&7\u21E8 &eClick to change your layout"));
|
||||
menu.addMenuClickHandler(i, (pl, slot, item, action) -> {
|
||||
pl.getInventory().setItemInMainHand(getItem(SlimefunGuideLayout.CHEST));
|
||||
openSettings(pl, pl.getInventory().getItemInMainHand());
|
||||
return false;
|
||||
});
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
if (SlimefunPlugin.getRegistry().isResearchFireworkEnabled()) {
|
||||
if (!PersistentDataAPI.hasByte(p, FIREWORKS_KEY) || PersistentDataAPI.getByte(p, FIREWORKS_KEY) == (byte) 1) {
|
||||
menu.addItem(i, new CustomItem(Material.FIREWORK_ROCKET, "&bFireworks: &aYes", "", "&7When researching items, you will", "&7be presented with a big firework.", "", "&7\u21E8 &eClick to disable your fireworks"), (pl, slot, item, action) -> {
|
||||
PersistentDataAPI.setByte(pl, FIREWORKS_KEY, (byte) 0);
|
||||
openSettings(pl, guide);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
else {
|
||||
menu.addItem(i, new CustomItem(Material.FIREWORK_ROCKET, "&bFireworks: &4No", "", "&7When researching items, you will", "&7not be presented with a big firework.", "", "&7\u21E8 &eClick to enable your fireworks"), (pl, slot, item, action) -> {
|
||||
PersistentDataAPI.setByte(pl, FIREWORKS_KEY, (byte) 1);
|
||||
openSettings(pl, guide);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
if (SlimefunPlugin.getLocal().isEnabled()) {
|
||||
Language language = SlimefunPlugin.getLocal().getLanguage(p);
|
||||
String languageName = language.isDefault() ? (SlimefunPlugin.getLocal().getMessage(p, "languages.default") + ChatColor.DARK_GRAY + " (" + language.getName(p) + ")") : SlimefunPlugin.getLocal().getMessage(p, "languages." + language.getID());
|
||||
|
||||
menu.addItem(i, new CustomItem(language.getItem(), "&7" + SlimefunPlugin.getLocal().getMessage(p, "guide.languages.selected-language") + " &a" + languageName, "", "&7You now have the option to change", "&7the language in which Slimefun", "&7will send you messages.", "&7Note that this only translates", "&7some messages, not items.", "&7&oThis feature is still being worked on", "", "&7\u21E8 &eClick to change your language"), (pl, slot, item, action) -> {
|
||||
openLanguages(pl);
|
||||
return false;
|
||||
});
|
||||
|
||||
// i++;
|
||||
}
|
||||
}
|
||||
|
||||
private static void openLanguages(Player p) {
|
||||
ChestMenu menu = new ChestMenu(SlimefunPlugin.getLocal().getMessage(p, "guide.title.languages"));
|
||||
|
||||
menu.setEmptySlotsClickable(false);
|
||||
menu.addMenuOpeningHandler(pl -> pl.playSound(pl.getLocation(), Sound.BLOCK_NOTE_BLOCK_HARP, 0.7F, 0.7F));
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
if (i == 1) {
|
||||
menu.addItem(1, ChestMenuUtils.getBackButton(p, "", "&7" + SlimefunPlugin.getLocal().getMessage(p, "guide.back.settings")), (pl, slot, item, action) -> {
|
||||
openSettings(pl, p.getInventory().getItemInMainHand());
|
||||
return false;
|
||||
});
|
||||
}
|
||||
else if (i == 7) {
|
||||
menu.addItem(7, new CustomItem(SkullItem.fromHash("3edd20be93520949e6ce789dc4f43efaeb28c717ee6bfcbbe02780142f716"), SlimefunPlugin.getLocal().getMessage(p, "guide.languages.translations.name"), "", "&7\u21E8 &e" + SlimefunPlugin.getLocal().getMessage(p, "guide.languages.translations.lore")), (pl, slot, item, action) -> {
|
||||
ChatUtils.sendURL(pl, "https://github.com/TheBusyBiscuit/Slimefun4/wiki/Translating-Slimefun");
|
||||
pl.closeInventory();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
else {
|
||||
menu.addItem(i, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler());
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
Language defaultLanguage = SlimefunPlugin.getLocal().getDefaultLanguage();
|
||||
String defaultLanguageString = SlimefunPlugin.getLocal().getMessage(p, "languages.default");
|
||||
|
||||
menu.addItem(9, new CustomItem(defaultLanguage.getItem(), ChatColor.GRAY + defaultLanguageString + ChatColor.DARK_GRAY + " (" + defaultLanguage.getName(p) + ")", "", "&7\u21E8 &e" + SlimefunPlugin.getLocal().getMessage(p, "guide.languages.select-default")), (pl, i, item, action) -> {
|
||||
SlimefunPlugin.instance.getServer().getPluginManager().callEvent(new PlayerLanguageChangeEvent(pl, SlimefunPlugin.getLocal().getLanguage(pl), defaultLanguage));
|
||||
PersistentDataAPI.remove(pl, SlimefunPlugin.getLocal().getKey());
|
||||
|
||||
SlimefunPlugin.getLocal().sendMessage(pl, "guide.languages.updated", msg -> msg.replace("%lang%", defaultLanguageString));
|
||||
|
||||
openSettings(pl, p.getInventory().getItemInMainHand());
|
||||
return false;
|
||||
});
|
||||
|
||||
int slot = 10;
|
||||
|
||||
for (Language language : SlimefunPlugin.getLocal().getLanguages()) {
|
||||
menu.addItem(slot, new CustomItem(language.getItem(), ChatColor.GREEN + language.getName(p), "&b" + SlimefunPlugin.getLocal().getProgress(language) + '%', "", "&7\u21E8 &e" + SlimefunPlugin.getLocal().getMessage(p, "guide.languages.select")), (pl, i, item, action) -> {
|
||||
SlimefunPlugin.instance.getServer().getPluginManager().callEvent(new PlayerLanguageChangeEvent(pl, SlimefunPlugin.getLocal().getLanguage(pl), language));
|
||||
PersistentDataAPI.setString(pl, SlimefunPlugin.getLocal().getKey(), language.getID());
|
||||
|
||||
String name = language.getName(pl);
|
||||
SlimefunPlugin.getLocal().sendMessage(pl, "guide.languages.updated", msg -> msg.replace("%lang%", name));
|
||||
|
||||
openSettings(pl, p.getInventory().getItemInMainHand());
|
||||
return false;
|
||||
});
|
||||
|
||||
slot++;
|
||||
}
|
||||
|
||||
menu.open(p);
|
||||
}
|
||||
|
||||
private static void openCredits(Player p, int page) {
|
||||
@ -339,12 +225,15 @@ public final class SlimefunGuideSettings {
|
||||
return skull;
|
||||
}
|
||||
|
||||
private static ItemStack getItem(SlimefunGuideLayout layout) {
|
||||
return SlimefunGuide.getItem(layout);
|
||||
}
|
||||
|
||||
public static boolean hasFireworksEnabled(Player p) {
|
||||
return !PersistentDataAPI.hasByte(p, FIREWORKS_KEY) || PersistentDataAPI.getByte(p, FIREWORKS_KEY) == (byte) 1;
|
||||
for (SlimefunGuideOption<?> option : options) {
|
||||
if (option instanceof OptionFireworks) {
|
||||
OptionFireworks fireworks = (OptionFireworks) option;
|
||||
return fireworks.getSelectedOption(p, SlimefunGuide.getItem(SlimefunGuideLayout.CHEST)).orElse(true);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -10,7 +10,8 @@ import org.bukkit.block.TileState;
|
||||
import org.bukkit.persistence.PersistentDataHolder;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.data.PersistentDataAPI;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
|
||||
/**
|
||||
* The {@link BlockDataService} is similar to the {@link CustomItemDataService},
|
||||
@ -21,7 +22,7 @@ import io.github.thebusybiscuit.cscorelib2.data.PersistentDataAPI;
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
*/
|
||||
public class BlockDataService {
|
||||
public class BlockDataService implements PersistentDataService {
|
||||
|
||||
private final NamespacedKey namespacedKey;
|
||||
|
||||
@ -41,7 +42,7 @@ public class BlockDataService {
|
||||
BlockState state = b.getState();
|
||||
|
||||
if (state instanceof TileState) {
|
||||
PersistentDataAPI.setString((TileState) state, namespacedKey, value);
|
||||
setString((TileState) state, namespacedKey, value);
|
||||
state.update();
|
||||
}
|
||||
}
|
||||
@ -57,7 +58,7 @@ public class BlockDataService {
|
||||
BlockState state = b.getState();
|
||||
|
||||
if (state instanceof TileState) {
|
||||
return PersistentDataAPI.getOptionalString((TileState) state, namespacedKey);
|
||||
return getString((TileState) state, namespacedKey);
|
||||
}
|
||||
else {
|
||||
return Optional.empty();
|
||||
@ -77,6 +78,10 @@ public class BlockDataService {
|
||||
* @return Whether the given {@link Material} is considered a Tile Entity
|
||||
*/
|
||||
public boolean isTileEntity(Material type) {
|
||||
if (!SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case PLAYER_HEAD:
|
||||
case PLAYER_WALL_HEAD:
|
||||
|
@ -7,7 +7,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.data.PersistentDataAPI;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
|
||||
@ -21,7 +20,7 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
* @see SlimefunItemStack
|
||||
*
|
||||
*/
|
||||
public class CustomItemDataService {
|
||||
public class CustomItemDataService implements PersistentDataService {
|
||||
|
||||
private final NamespacedKey namespacedKey;
|
||||
|
||||
@ -36,7 +35,7 @@ public class CustomItemDataService {
|
||||
}
|
||||
|
||||
public void setItemData(ItemMeta im, String id) {
|
||||
PersistentDataAPI.setString(im, namespacedKey, id);
|
||||
setString(im, namespacedKey, id);
|
||||
}
|
||||
|
||||
public Optional<String> getItemData(ItemStack item) {
|
||||
@ -44,7 +43,7 @@ public class CustomItemDataService {
|
||||
}
|
||||
|
||||
public Optional<String> getItemData(ItemMeta meta) {
|
||||
return PersistentDataAPI.getOptionalString(meta, namespacedKey);
|
||||
return getString(meta, namespacedKey);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.config.Config;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
|
||||
@ -30,7 +32,6 @@ public class CustomTextureService {
|
||||
config = new Config(plugin, "item-models.yml");
|
||||
|
||||
config.getConfiguration().options().header("This file is used to assign items from Slimefun or any of its addons\n" + "the 'CustomModelData' NBT tag. This can be used in conjunction with a custom resource pack\n" + "to give items custom textures.\n\n" + "There is no official Slimefun resource pack at the moment.");
|
||||
|
||||
config.getConfiguration().options().copyHeader(true);
|
||||
}
|
||||
|
||||
@ -80,7 +81,10 @@ public class CustomTextureService {
|
||||
|
||||
public void setTexture(ItemMeta im, String id) {
|
||||
int data = getModelData(id);
|
||||
im.setCustomModelData(data == 0 ? null : data);
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
im.setCustomModelData(data == 0 ? null : data);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.data.PersistentDataAPI;
|
||||
import io.github.thebusybiscuit.cscorelib2.math.DoubleHandler;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.localization.SlimefunLocalization;
|
||||
@ -32,7 +31,7 @@ import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
* @see Language
|
||||
*
|
||||
*/
|
||||
public class LocalizationService extends SlimefunLocalization {
|
||||
public class LocalizationService extends SlimefunLocalization implements PersistentDataService {
|
||||
|
||||
private static final String LANGUAGE_PATH = "language";
|
||||
|
||||
@ -108,7 +107,7 @@ public class LocalizationService extends SlimefunLocalization {
|
||||
|
||||
@Override
|
||||
public Language getLanguage(Player p) {
|
||||
Optional<String> language = PersistentDataAPI.getOptionalString(p, languageKey);
|
||||
Optional<String> language = getString(p, languageKey);
|
||||
|
||||
if (language.isPresent()) {
|
||||
Language lang = languages.get(language.get());
|
||||
|
@ -0,0 +1,31 @@
|
||||
package io.github.thebusybiscuit.slimefun4.core.services;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.persistence.PersistentDataContainer;
|
||||
import org.bukkit.persistence.PersistentDataHolder;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
|
||||
interface PersistentDataService {
|
||||
|
||||
default void setString(Object obj, NamespacedKey key, String value) {
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14) && obj instanceof PersistentDataHolder) {
|
||||
PersistentDataContainer container = ((PersistentDataHolder) obj).getPersistentDataContainer();
|
||||
container.set(key, PersistentDataType.STRING, value);
|
||||
}
|
||||
}
|
||||
|
||||
default Optional<String> getString(Object obj, NamespacedKey key) {
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14) && obj instanceof PersistentDataHolder) {
|
||||
PersistentDataContainer container = ((PersistentDataHolder) obj).getPersistentDataContainer();
|
||||
return Optional.ofNullable(container.get(key, PersistentDataType.STRING));
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
package io.github.thebusybiscuit.slimefun4.core.services.localization;
|
||||
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -45,7 +47,12 @@ public final class Language {
|
||||
SlimefunPlugin.getItemTextureService().setTexture(item, "_UI_LANGUAGE_" + id.toUpperCase());
|
||||
}
|
||||
|
||||
public String getID() {
|
||||
/**
|
||||
* This returns the identifier of this {@link Language}.
|
||||
*
|
||||
* @return The identifier of this {@link Language}
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
@ -18,9 +18,9 @@ class PlayerLanguageChart extends AdvancedPie {
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
Language language = SlimefunPlugin.getLocal().getLanguage(p);
|
||||
boolean supported = SlimefunPlugin.getLocal().isLanguageLoaded(language.getID());
|
||||
boolean supported = SlimefunPlugin.getLocal().isLanguageLoaded(language.getId());
|
||||
|
||||
String lang = supported ? language.getID() : "Unsupported Language";
|
||||
String lang = supported ? language.getId() : "Unsupported Language";
|
||||
languages.merge(lang, 1, Integer::sum);
|
||||
}
|
||||
|
||||
|
@ -10,8 +10,8 @@ class ServerLanguageChart extends SimplePie {
|
||||
ServerLanguageChart() {
|
||||
super("language", () -> {
|
||||
Language language = SlimefunPlugin.getLocal().getDefaultLanguage();
|
||||
boolean supported = SlimefunPlugin.getLocal().isLanguageLoaded(language.getID());
|
||||
return supported ? language.getID() : "Unsupported Language";
|
||||
boolean supported = SlimefunPlugin.getLocal().isLanguageLoaded(language.getId());
|
||||
return supported ? language.getId() : "Unsupported Language";
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@ import io.github.thebusybiscuit.cscorelib2.chat.ChatInput;
|
||||
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.cscorelib2.recipes.MinecraftRecipe;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||
import io.github.thebusybiscuit.slimefun4.core.MultiBlock;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
|
||||
@ -30,7 +31,7 @@ import io.github.thebusybiscuit.slimefun4.core.guide.GuideHistory;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideImplementation;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideLayout;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideSettings;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.options.SlimefunGuideSettings;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
||||
@ -54,9 +55,15 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
private final Sound sound;
|
||||
private final boolean showVanillaRecipes;
|
||||
|
||||
public ChestSlimefunGuide(boolean showVanillaRecipes) {
|
||||
this.showVanillaRecipes = showVanillaRecipes;
|
||||
this.sound = Sound.ITEM_BOOK_PAGE_TURN;
|
||||
public ChestSlimefunGuide(boolean vanillaRecipes) {
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
sound = Sound.ITEM_BOOK_PAGE_TURN;
|
||||
showVanillaRecipes = vanillaRecipes;
|
||||
}
|
||||
else {
|
||||
sound = Sound.ENTITY_BAT_TAKEOFF;
|
||||
showVanillaRecipes = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -271,7 +278,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (RuntimeException x) {
|
||||
catch (Throwable x) {
|
||||
printErrorMessage(pl, x);
|
||||
}
|
||||
|
||||
@ -335,7 +342,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
displayItem(profile, item, true);
|
||||
}
|
||||
}
|
||||
catch (RuntimeException x) {
|
||||
catch (Throwable x) {
|
||||
printErrorMessage(pl, x);
|
||||
}
|
||||
|
||||
@ -423,7 +430,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
profile.getGuideHistory().add(item, index);
|
||||
}
|
||||
|
||||
displayItem(menu, profile, p, item, result, recipeType, recipeItems, task, addToHistory);
|
||||
displayItem(menu, profile, p, item, result, recipeType, recipeItems, task);
|
||||
|
||||
if (recipes.length > 1) {
|
||||
for (int i = 27; i < 36; i++) {
|
||||
@ -479,7 +486,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
profile.getGuideHistory().add(item);
|
||||
}
|
||||
|
||||
displayItem(menu, profile, p, item, result, recipeType, recipe, task, addToHistory);
|
||||
displayItem(menu, profile, p, item, result, recipeType, recipe, task);
|
||||
|
||||
if (item instanceof RecipeDisplayItem) {
|
||||
displayRecipes(p, profile, menu, (RecipeDisplayItem) item, 0);
|
||||
@ -492,7 +499,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
}
|
||||
}
|
||||
|
||||
private void displayItem(ChestMenu menu, PlayerProfile profile, Player p, Object item, ItemStack output, RecipeType recipeType, ItemStack[] recipe, RecipeChoiceTask task, boolean addToHistory) {
|
||||
private void displayItem(ChestMenu menu, PlayerProfile profile, Player p, Object item, ItemStack output, RecipeType recipeType, ItemStack[] recipe, RecipeChoiceTask task) {
|
||||
boolean isSlimefunRecipe = item instanceof SlimefunItem;
|
||||
|
||||
addBackButton(menu, 0, p, profile, true);
|
||||
@ -503,7 +510,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
displayItem(profile, itemstack, 0, true);
|
||||
}
|
||||
}
|
||||
catch (RuntimeException x) {
|
||||
catch (Throwable x) {
|
||||
printErrorMessage(pl, x);
|
||||
}
|
||||
return false;
|
||||
@ -680,9 +687,9 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
return menu;
|
||||
}
|
||||
|
||||
private void printErrorMessage(Player p, RuntimeException x) {
|
||||
private void printErrorMessage(Player p, Throwable x) {
|
||||
p.sendMessage(ChatColor.DARK_RED + "An internal server error has occured. Please inform an admin, check the console for further info.");
|
||||
Slimefun.getLogger().log(Level.SEVERE, "An error has occured while trying to open a SlimefunItem in the guide!");
|
||||
Slimefun.getLogger().log(Level.SEVERE, "An error has occured while trying to open a SlimefunItem in the guide!", x);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.Ageable;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
@ -49,6 +51,10 @@ public abstract class FarmerAndroid extends ProgrammableAndroid {
|
||||
|
||||
private ItemStack getDropFromCrop(Material crop) {
|
||||
Random random = ThreadLocalRandom.current();
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14) && crop == Material.SWEET_BERRY_BUSH) {
|
||||
return new ItemStack(Material.SWEET_BERRIES, random.nextInt(3) + 1);
|
||||
}
|
||||
|
||||
switch (crop) {
|
||||
case WHEAT:
|
||||
@ -63,8 +69,6 @@ public abstract class FarmerAndroid extends ProgrammableAndroid {
|
||||
return new ItemStack(Material.COCOA_BEANS, random.nextInt(3) + 1);
|
||||
case NETHER_WART:
|
||||
return new ItemStack(Material.NETHER_WART, random.nextInt(3) + 1);
|
||||
case SWEET_BERRY_BUSH:
|
||||
return new ItemStack(Material.SWEET_BERRIES, random.nextInt(3) + 1);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
@ -162,10 +162,9 @@ public abstract class ProgrammableAndroid extends Android implements InventoryBl
|
||||
registerFuel(new MachineFuel(800, new ItemStack(Material.COAL_BLOCK)));
|
||||
registerFuel(new MachineFuel(45, new ItemStack(Material.BLAZE_ROD)));
|
||||
|
||||
// Coals
|
||||
for (Material mat : Tag.ITEMS_COALS.getValues()) {
|
||||
registerFuel(new MachineFuel(8, new ItemStack(mat)));
|
||||
}
|
||||
// Coal & Charcoal
|
||||
registerFuel(new MachineFuel(8, new ItemStack(Material.COAL)));
|
||||
registerFuel(new MachineFuel(8, new ItemStack(Material.CHARCOAL)));
|
||||
|
||||
// Logs
|
||||
for (Material mat : Tag.LOGS.getValues()) {
|
||||
|
@ -13,6 +13,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BlockStateMeta;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
@ -92,7 +93,7 @@ public class BlockPlacer extends SimpleSlimefunItem<BlockDispenseHandler> {
|
||||
// applies to shulker boxes)
|
||||
// Inventory has to be changed after blockState.update() as updating it will create a different Inventory
|
||||
// for the object
|
||||
if (blockState instanceof BlockInventoryHolder) {
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14) && blockState instanceof BlockInventoryHolder) {
|
||||
((BlockInventoryHolder) blockState).getInventory().setContents(((BlockInventoryHolder) itemBlockState).getInventory().getContents());
|
||||
}
|
||||
|
||||
|
@ -21,10 +21,9 @@ public abstract class CoalGenerator extends AGenerator {
|
||||
registerFuel(new MachineFuel(80, new ItemStack(Material.COAL_BLOCK)));
|
||||
registerFuel(new MachineFuel(12, new ItemStack(Material.BLAZE_ROD)));
|
||||
|
||||
// Coals
|
||||
for (Material mat : Tag.ITEMS_COALS.getValues()) {
|
||||
registerFuel(new MachineFuel(8, new ItemStack(mat)));
|
||||
}
|
||||
// Coal & Charcoal
|
||||
registerFuel(new MachineFuel(8, new ItemStack(Material.COAL)));
|
||||
registerFuel(new MachineFuel(8, new ItemStack(Material.CHARCOAL)));
|
||||
|
||||
// Logs
|
||||
for (Material mat : Tag.LOGS.getValues()) {
|
||||
|
@ -4,7 +4,7 @@ import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.CookingRecipe;
|
||||
import org.bukkit.inventory.FurnaceRecipe;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.Recipe;
|
||||
import org.bukkit.inventory.RecipeChoice;
|
||||
@ -27,8 +27,8 @@ public abstract class ElectricFurnace extends AContainer {
|
||||
while (iterator.hasNext()) {
|
||||
Recipe recipe = iterator.next();
|
||||
|
||||
if (recipe instanceof CookingRecipe) {
|
||||
RecipeChoice choice = ((CookingRecipe<?>) recipe).getInputChoice();
|
||||
if (recipe instanceof FurnaceRecipe) {
|
||||
RecipeChoice choice = ((FurnaceRecipe) recipe).getInputChoice();
|
||||
|
||||
if (choice instanceof MaterialChoice) {
|
||||
for (Material input : ((MaterialChoice) choice).getChoices()) {
|
||||
|
@ -15,6 +15,7 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.Categories;
|
||||
@ -25,7 +26,11 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.MultiBlockMach
|
||||
public class PressureChamber extends MultiBlockMachine {
|
||||
|
||||
public PressureChamber() {
|
||||
super(Categories.MACHINES_1, SlimefunItems.PRESSURE_CHAMBER, new ItemStack[] { new ItemStack(Material.SMOOTH_STONE_SLAB), new CustomItem(Material.DISPENSER, "Dispenser (Facing down)"), new ItemStack(Material.SMOOTH_STONE_SLAB), new ItemStack(Material.PISTON), new ItemStack(Material.GLASS), new ItemStack(Material.PISTON), new ItemStack(Material.PISTON), new ItemStack(Material.CAULDRON), new ItemStack(Material.PISTON) }, new ItemStack[0], BlockFace.UP);
|
||||
super(Categories.MACHINES_1, SlimefunItems.PRESSURE_CHAMBER, new ItemStack[] {
|
||||
SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14) ? new ItemStack(Material.SMOOTH_STONE_SLAB) : new ItemStack(Material.STONE_SLAB), new CustomItem(Material.DISPENSER, "Dispenser (Facing down)"), SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14) ? new ItemStack(Material.SMOOTH_STONE_SLAB) : new ItemStack(Material.STONE_SLAB),
|
||||
new ItemStack(Material.PISTON), new ItemStack(Material.GLASS), new ItemStack(Material.PISTON),
|
||||
new ItemStack(Material.PISTON), new ItemStack(Material.CAULDRON), new ItemStack(Material.PISTON)
|
||||
}, new ItemStack[0], BlockFace.UP);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -8,10 +8,10 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.events.PlayerRightClickEvent;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideSettings;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideLayout;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.options.SlimefunGuideSettings;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
|
||||
public class SlimefunGuideListener implements Listener {
|
||||
|
@ -12,6 +12,7 @@ import org.bukkit.inventory.BrewerInventory;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
@ -26,6 +27,10 @@ public class VanillaMachinesListener implements Listener {
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onGrindstone(InventoryClickEvent e) {
|
||||
if (!SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.getRawSlot() == 2 && e.getWhoClicked() instanceof Player && e.getInventory().getType() == InventoryType.GRINDSTONE) {
|
||||
ItemStack item1 = e.getInventory().getContents()[0];
|
||||
ItemStack item2 = e.getInventory().getContents()[1];
|
||||
|
@ -107,7 +107,8 @@ public final class PostSetup {
|
||||
sender.sendMessage(ChatColor.GREEN + "Successfully loaded " + total + " Items and " + SlimefunPlugin.getRegistry().getResearches().size() + " Researches");
|
||||
sender.sendMessage(ChatColor.GREEN + "( " + vanilla + " Items from Slimefun, " + (total - vanilla) + " Items from " + SlimefunPlugin.getInstalledAddons().size() + " Addons )");
|
||||
sender.sendMessage("");
|
||||
sender.sendMessage(ChatColor.GREEN + "Slimefun is an Open-Source project that is maintained by community developers!");
|
||||
sender.sendMessage(ChatColor.GREEN + "Slimefun is an Open-Source project that is kept alive by a large community.");
|
||||
sender.sendMessage(ChatColor.GREEN + "Consider helping us maintain this project by contributing on GitHub!");
|
||||
|
||||
if (SlimefunPlugin.getUpdater().getBranch().isOfficial()) {
|
||||
sender.sendMessage("");
|
||||
|
@ -23,6 +23,7 @@ import io.github.thebusybiscuit.cscorelib2.inventory.InvUtils;
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.cscorelib2.materials.MaterialCollections;
|
||||
import io.github.thebusybiscuit.cscorelib2.skull.SkullItem;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.core.MultiBlock;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.Radioactivity;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.EasterEgg;
|
||||
@ -187,6 +188,26 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
*
|
||||
*/
|
||||
public final class SlimefunItemSetup {
|
||||
|
||||
private static final Material RED_DYE;
|
||||
private static final Material YELLOW_DYE;
|
||||
private static final Material BLACK_DYE;
|
||||
private static final Material GREEN_DYE;
|
||||
|
||||
static {
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
RED_DYE = Material.RED_DYE;
|
||||
YELLOW_DYE = Material.YELLOW_DYE;
|
||||
BLACK_DYE = Material.BLACK_DYE;
|
||||
GREEN_DYE = Material.GREEN_DYE;
|
||||
}
|
||||
else {
|
||||
RED_DYE = Material.valueOf("ROSE_RED");
|
||||
YELLOW_DYE = Material.valueOf("DANDELION_YELLOW");
|
||||
BLACK_DYE = Material.valueOf("INK_SAC");
|
||||
GREEN_DYE = Material.valueOf("CACTUS_GREEN");
|
||||
}
|
||||
}
|
||||
|
||||
private SlimefunItemSetup() {}
|
||||
|
||||
@ -743,9 +764,11 @@ public final class SlimefunItemSetup {
|
||||
new ItemStack[] {null, null, SlimefunItems.LAVA_CRYSTAL, null, SlimefunItems.STAFF_ELEMENTAL, null, SlimefunItems.STAFF_ELEMENTAL, null, null})
|
||||
.register(plugin);
|
||||
|
||||
new StormStaff(Categories.MAGIC, SlimefunItems.STAFF_STORM, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {SlimefunItems.RUNE_LIGHTNING, SlimefunItems.ENDER_LUMP_3, SlimefunItems.RUNE_LIGHTNING, SlimefunItems.STAFF_WATER, SlimefunItems.MAGIC_SUGAR, SlimefunItems.STAFF_WIND, SlimefunItems.RUNE_LIGHTNING, SlimefunItems.ENDER_LUMP_3, SlimefunItems.RUNE_LIGHTNING})
|
||||
.register(plugin);
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
new StormStaff(Categories.MAGIC, SlimefunItems.STAFF_STORM, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {SlimefunItems.RUNE_LIGHTNING, SlimefunItems.ENDER_LUMP_3, SlimefunItems.RUNE_LIGHTNING, SlimefunItems.STAFF_WATER, SlimefunItems.MAGIC_SUGAR, SlimefunItems.STAFF_WIND, SlimefunItems.RUNE_LIGHTNING, SlimefunItems.ENDER_LUMP_3, SlimefunItems.RUNE_LIGHTNING})
|
||||
.register(plugin);
|
||||
}
|
||||
|
||||
new SmeltersPickaxe(Categories.TOOLS, SlimefunItems.AUTO_SMELT_PICKAXE, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||
new ItemStack[] {SlimefunItems.LAVA_CRYSTAL, SlimefunItems.LAVA_CRYSTAL, SlimefunItems.LAVA_CRYSTAL, null, SlimefunItems.FERROSILICON, null, null, SlimefunItems.FERROSILICON, null})
|
||||
@ -952,8 +975,10 @@ public final class SlimefunItemSetup {
|
||||
new HerculesPickaxe(Categories.TOOLS, SlimefunItems.HERCULES_PICKAXE, RecipeType.MAGIC_WORKBENCH,
|
||||
new ItemStack[] {SlimefunItems.HARDENED_METAL_INGOT, SlimefunItems.HARDENED_METAL_INGOT, SlimefunItems.HARDENED_METAL_INGOT, null, SlimefunItems.FERROSILICON, null, null, SlimefunItems.FERROSILICON, null})
|
||||
.register(plugin);
|
||||
|
||||
new TableSaw().register(plugin);
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
new TableSaw().register(plugin);
|
||||
}
|
||||
|
||||
new SlimefunItem(Categories.MAGIC_ARMOR, SlimefunItems.SLIME_HELMET_STEEL, RecipeType.ARMOR_FORGE,
|
||||
new ItemStack[] {new ItemStack(Material.SLIME_BALL), SlimefunItems.STEEL_PLATE, new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), null, new ItemStack(Material.SLIME_BALL), null, null, null})
|
||||
@ -1307,9 +1332,11 @@ public final class SlimefunItemSetup {
|
||||
new ItemStack[] {new ItemStack(Material.PUMPKIN), null, null, null, null, null, null, null, null})
|
||||
.register(plugin);
|
||||
|
||||
new Juice(Categories.FOOD, (SlimefunItemStack) SlimefunItems.SWEET_BERRY_JUICE, RecipeType.JUICER,
|
||||
new ItemStack[] {new ItemStack(Material.SWEET_BERRIES), null, null, null, null, null, null, null, null})
|
||||
.register(plugin);
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
new Juice(Categories.FOOD, (SlimefunItemStack) SlimefunItems.SWEET_BERRY_JUICE, RecipeType.JUICER,
|
||||
new ItemStack[] {new ItemStack(Material.SWEET_BERRIES), null, null, null, null, null, null, null, null})
|
||||
.register(plugin);
|
||||
}
|
||||
|
||||
new Juice(Categories.FOOD, (SlimefunItemStack) SlimefunItems.GOLDEN_APPLE_JUICE, RecipeType.JUICER,
|
||||
new ItemStack[] {new ItemStack(Material.GOLDEN_APPLE), null, null, null, null, null, null, null, null})
|
||||
@ -2045,9 +2072,11 @@ public final class SlimefunItemSetup {
|
||||
|
||||
}.register(plugin);
|
||||
|
||||
new AutoDrier(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.AUTO_DRIER, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||
new ItemStack[] {null, null, null, SlimefunItems.HEATING_COIL, new ItemStack(Material.SMOKER), SlimefunItems.HEATING_COIL, null, new ItemStack(Material.CAMPFIRE), null})
|
||||
.register(plugin);
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
new AutoDrier(Categories.ELECTRICITY, SlimefunItems.AUTO_DRIER, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||
new ItemStack[] {null, null, null, SlimefunItems.HEATING_COIL, new ItemStack(Material.SMOKER), SlimefunItems.HEATING_COIL, null, new ItemStack(Material.CAMPFIRE), null})
|
||||
.register(plugin);
|
||||
}
|
||||
|
||||
new ElectricPress(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.ELECTRIC_PRESS, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||
new ItemStack[] {new ItemStack(Material.PISTON), SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.PISTON), null, SlimefunItems.MEDIUM_CAPACITOR, null, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT}) {
|
||||
@ -2526,7 +2555,7 @@ public final class SlimefunItemSetup {
|
||||
.register(plugin);
|
||||
|
||||
new SlimefunItem(Categories.LUMPS_AND_MAGIC, SlimefunItems.RUNE_RAINBOW, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(Material.RED_DYE), SlimefunItems.MAGIC_LUMP_3, new ItemStack(Material.CYAN_DYE), new ItemStack(Material.WHITE_WOOL), SlimefunItems.RUNE_ENDER, new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.YELLOW_DYE), SlimefunItems.ENDER_LUMP_3, new ItemStack(Material.MAGENTA_DYE)})
|
||||
new ItemStack[] {new ItemStack(RED_DYE), SlimefunItems.MAGIC_LUMP_3, new ItemStack(Material.CYAN_DYE), new ItemStack(Material.WHITE_WOOL), SlimefunItems.RUNE_ENDER, new ItemStack(Material.WHITE_WOOL), new ItemStack(YELLOW_DYE), SlimefunItems.ENDER_LUMP_3, new ItemStack(Material.MAGENTA_DYE)})
|
||||
.register(plugin);
|
||||
|
||||
new SoulboundRune(Categories.LUMPS_AND_MAGIC, SlimefunItems.RUNE_SOULBOUND, RecipeType.ANCIENT_ALTAR,
|
||||
@ -2591,96 +2620,96 @@ public final class SlimefunItemSetup {
|
||||
// Christmas
|
||||
|
||||
new RainbowBlock(Categories.CHRISTMAS, SlimefunItems.RAINBOW_WOOL_XMAS, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(Material.RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.GREEN_DYE), new ItemStack(Material.WHITE_WOOL), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.RED_DYE)},
|
||||
new ItemStack[] {new ItemStack(RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(GREEN_DYE), new ItemStack(Material.WHITE_WOOL), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_WOOL), new ItemStack(GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(RED_DYE)},
|
||||
new CustomItem(SlimefunItems.RAINBOW_WOOL_XMAS, 2), new RainbowTicker(Material.RED_WOOL, Material.GREEN_WOOL))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(Categories.CHRISTMAS, SlimefunItems.RAINBOW_GLASS_XMAS, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(Material.RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.GREEN_DYE), new ItemStack(Material.WHITE_STAINED_GLASS), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.RED_DYE)},
|
||||
new ItemStack[] {new ItemStack(RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(GREEN_DYE), new ItemStack(Material.WHITE_STAINED_GLASS), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(RED_DYE)},
|
||||
new CustomItem(SlimefunItems.RAINBOW_GLASS_XMAS, 2), new RainbowTicker(Material.RED_STAINED_GLASS, Material.GREEN_STAINED_GLASS))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(Categories.CHRISTMAS, SlimefunItems.RAINBOW_GLASS_PANE_XMAS, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(Material.RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.GREEN_DYE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.RED_DYE)},
|
||||
new ItemStack[] {new ItemStack(RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(GREEN_DYE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(RED_DYE)},
|
||||
new CustomItem(SlimefunItems.RAINBOW_GLASS_PANE_XMAS, 2), new RainbowTicker(Material.RED_STAINED_GLASS_PANE, Material.GREEN_STAINED_GLASS_PANE))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(Categories.CHRISTMAS, SlimefunItems.RAINBOW_CLAY_XMAS, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(Material.RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.GREEN_DYE), new ItemStack(Material.WHITE_TERRACOTTA), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.RED_DYE)},
|
||||
new ItemStack[] {new ItemStack(RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(GREEN_DYE), new ItemStack(Material.WHITE_TERRACOTTA), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(RED_DYE)},
|
||||
new CustomItem(SlimefunItems.RAINBOW_CLAY_XMAS, 2), new RainbowTicker(Material.RED_TERRACOTTA, Material.GREEN_TERRACOTTA))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(Categories.CHRISTMAS, SlimefunItems.RAINBOW_CONCRETE_XMAS, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(Material.RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.GREEN_DYE), new ItemStack(Material.WHITE_CONCRETE), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.RED_DYE)},
|
||||
new ItemStack[] {new ItemStack(RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(GREEN_DYE), new ItemStack(Material.WHITE_CONCRETE), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_CONCRETE), new ItemStack(GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(RED_DYE)},
|
||||
new CustomItem(SlimefunItems.RAINBOW_CONCRETE_XMAS, 2), new RainbowTicker(Material.RED_CONCRETE, Material.GREEN_CONCRETE))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(Categories.CHRISTMAS, SlimefunItems.RAINBOW_GLAZED_TERRACOTTA_XMAS, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(Material.RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.GREEN_DYE), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.RED_DYE)},
|
||||
new ItemStack[] {new ItemStack(RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(GREEN_DYE), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(RED_DYE)},
|
||||
new CustomItem(SlimefunItems.RAINBOW_GLAZED_TERRACOTTA_XMAS, 2), new RainbowTicker(Material.RED_GLAZED_TERRACOTTA, Material.GREEN_GLAZED_TERRACOTTA))
|
||||
.register(plugin);
|
||||
|
||||
// Valentines Day
|
||||
|
||||
new RainbowBlock(Categories.VALENTINES_DAY, SlimefunItems.RAINBOW_WOOL_VALENTINE, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(Material.RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_WOOL), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.RED_DYE)},
|
||||
new ItemStack[] {new ItemStack(RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_WOOL), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(RED_DYE)},
|
||||
new CustomItem(SlimefunItems.RAINBOW_WOOL_VALENTINE, 2), new RainbowTicker(Material.MAGENTA_WOOL, Material.PINK_WOOL))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(Categories.VALENTINES_DAY, SlimefunItems.RAINBOW_GLASS_VALENTINE, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(Material.RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_STAINED_GLASS), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.RED_DYE)},
|
||||
new ItemStack[] {new ItemStack(RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_STAINED_GLASS), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(RED_DYE)},
|
||||
new CustomItem(SlimefunItems.RAINBOW_GLASS_VALENTINE, 2), new RainbowTicker(Material.MAGENTA_STAINED_GLASS, Material.PINK_STAINED_GLASS))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(Categories.VALENTINES_DAY, SlimefunItems.RAINBOW_GLASS_PANE_VALENTINE, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(Material.RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.RED_DYE)},
|
||||
new ItemStack[] {new ItemStack(RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(RED_DYE)},
|
||||
new CustomItem(SlimefunItems.RAINBOW_GLASS_PANE_VALENTINE, 2), new RainbowTicker(Material.MAGENTA_STAINED_GLASS_PANE, Material.PINK_STAINED_GLASS_PANE))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(Categories.VALENTINES_DAY, SlimefunItems.RAINBOW_CLAY_VALENTINE, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(Material.RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_TERRACOTTA), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.RED_DYE)},
|
||||
new ItemStack[] {new ItemStack(RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_TERRACOTTA), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(RED_DYE)},
|
||||
new CustomItem(SlimefunItems.RAINBOW_CLAY_VALENTINE, 2), new RainbowTicker(Material.MAGENTA_TERRACOTTA, Material.PINK_TERRACOTTA))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(Categories.VALENTINES_DAY, SlimefunItems.RAINBOW_CONCRETE_VALENTINE, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(Material.RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_CONCRETE), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.RED_DYE)},
|
||||
new ItemStack[] {new ItemStack(RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_CONCRETE), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(RED_DYE)},
|
||||
new CustomItem(SlimefunItems.RAINBOW_CONCRETE_VALENTINE, 2), new RainbowTicker(Material.MAGENTA_CONCRETE, Material.PINK_CONCRETE))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(Categories.VALENTINES_DAY, SlimefunItems.RAINBOW_GLAZED_TERRACOTTA_VALENTINE, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(Material.RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.RED_DYE)},
|
||||
new ItemStack[] {new ItemStack(RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(RED_DYE)},
|
||||
new CustomItem(SlimefunItems.RAINBOW_GLAZED_TERRACOTTA_VALENTINE, 2), new RainbowTicker(Material.MAGENTA_GLAZED_TERRACOTTA, Material.PINK_GLAZED_TERRACOTTA))
|
||||
.register(plugin);
|
||||
|
||||
// Halloween
|
||||
|
||||
new RainbowBlock(Categories.HALLOWEEN, SlimefunItems.RAINBOW_WOOL_HALLOWEEN, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.WHITE_WOOL), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)},
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(BLACK_DYE), new ItemStack(Material.WHITE_WOOL), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_WOOL), new ItemStack(BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)},
|
||||
new CustomItem(SlimefunItems.RAINBOW_WOOL_HALLOWEEN, 2), new RainbowTicker(Material.ORANGE_WOOL, Material.BLACK_WOOL))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(Categories.HALLOWEEN, SlimefunItems.RAINBOW_GLASS_HALLOWEEN, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.WHITE_STAINED_GLASS), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)},
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(BLACK_DYE), new ItemStack(Material.WHITE_STAINED_GLASS), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)},
|
||||
new CustomItem(SlimefunItems.RAINBOW_GLASS_HALLOWEEN, 2), new RainbowTicker(Material.ORANGE_STAINED_GLASS, Material.BLACK_STAINED_GLASS))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(Categories.HALLOWEEN, SlimefunItems.RAINBOW_GLASS_PANE_HALLOWEEN, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)},
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(BLACK_DYE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)},
|
||||
new CustomItem(SlimefunItems.RAINBOW_GLASS_PANE_HALLOWEEN, 2), new RainbowTicker(Material.ORANGE_STAINED_GLASS_PANE, Material.BLACK_STAINED_GLASS_PANE))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(Categories.HALLOWEEN, SlimefunItems.RAINBOW_CLAY_HALLOWEEN, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.WHITE_TERRACOTTA), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)},
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(BLACK_DYE), new ItemStack(Material.WHITE_TERRACOTTA), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)},
|
||||
new CustomItem(SlimefunItems.RAINBOW_CLAY_HALLOWEEN, 2), new RainbowTicker(Material.ORANGE_TERRACOTTA, Material.BLACK_TERRACOTTA))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(Categories.HALLOWEEN, SlimefunItems.RAINBOW_CONCRETE_HALLOWEEN, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.WHITE_CONCRETE), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)},
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(BLACK_DYE), new ItemStack(Material.WHITE_CONCRETE), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_CONCRETE), new ItemStack(BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)},
|
||||
new CustomItem(SlimefunItems.RAINBOW_CONCRETE_HALLOWEEN, 2), new RainbowTicker(Material.ORANGE_CONCRETE, Material.BLACK_CONCRETE))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(Categories.HALLOWEEN, SlimefunItems.RAINBOW_GLAZED_TERRACOTTA_HALLOWEEN, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)},
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(BLACK_DYE), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), SlimefunItems.RUNE_RAINBOW, new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)},
|
||||
new CustomItem(SlimefunItems.RAINBOW_GLAZED_TERRACOTTA_HALLOWEEN, 2), new RainbowTicker(Material.ORANGE_GLAZED_TERRACOTTA, Material.BLACK_GLAZED_TERRACOTTA))
|
||||
.register(plugin);
|
||||
|
||||
@ -2929,9 +2958,11 @@ public final class SlimefunItemSetup {
|
||||
new ItemStack[] {SlimefunItems.CAN, new ItemStack(Material.APPLE), null, null, null, null, null, null, null})
|
||||
.register(plugin);
|
||||
|
||||
new SlimefunItem(Categories.MISC, SlimefunItems.SWEET_BERRIES_ORGANIC_FOOD, RecipeType.FOOD_FABRICATOR,
|
||||
new ItemStack[] {SlimefunItems.CAN, new ItemStack(Material.SWEET_BERRIES), null, null, null, null, null, null, null})
|
||||
.register(plugin);
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
new SlimefunItem(Categories.MISC, SlimefunItems.SWEET_BERRIES_ORGANIC_FOOD, RecipeType.FOOD_FABRICATOR,
|
||||
new ItemStack[] {SlimefunItems.CAN, new ItemStack(Material.SWEET_BERRIES), null, null, null, null, null, null, null})
|
||||
.register(plugin);
|
||||
}
|
||||
|
||||
new SlimefunItem(Categories.MISC, SlimefunItems.KELP_ORGANIC_FOOD, RecipeType.FOOD_FABRICATOR,
|
||||
new ItemStack[] {SlimefunItems.CAN, new ItemStack(Material.DRIED_KELP), null, null, null, null, null, null, null})
|
||||
|
@ -20,4 +20,5 @@ public final class PatternUtils {
|
||||
public static final Pattern COMMA = Pattern.compile(",");
|
||||
public static final Pattern SLASH_SEPARATOR = Pattern.compile(" / ");
|
||||
public static final Pattern DASH = Pattern.compile("-");
|
||||
public static final Pattern ASCII = Pattern.compile("[A-Za-z \"_]+");
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.cscorelib2.skull.SkullItem;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.MachineTier;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.MachineType;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.Radioactivity;
|
||||
@ -20,6 +21,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.magical.StormStaf
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.LoreBuilder;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.itemstack.ColoredFireworkStar;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
|
||||
/**
|
||||
@ -515,7 +517,7 @@ public final class SlimefunItems {
|
||||
/* Machines */
|
||||
public static final SlimefunItemStack GRIND_STONE = new SlimefunItemStack("GRIND_STONE", Material.DISPENSER, "&bGrind Stone", "", "&aGrinds items down into other items");
|
||||
public static final SlimefunItemStack ARMOR_FORGE = new SlimefunItemStack("ARMOR_FORGE", Material.ANVIL, "&6Armor Forge", "", "&aGives you the ability to create powerful armor");
|
||||
public static final SlimefunItemStack MAKESHIFT_SMELTERY = new SlimefunItemStack("MAKESHIFT_SMELTERY", Material.BLAST_FURNACE, "&eMakeshift Smeltery", "", "&rImprovised version of the Smeltery", "&rthat only allows you to", "&rsmelt dusts into ingots");
|
||||
public static final SlimefunItemStack MAKESHIFT_SMELTERY;
|
||||
public static final SlimefunItemStack SMELTERY = new SlimefunItemStack("SMELTERY", Material.FURNACE, "&6Smeltery", "", "&rA high-temperature furnace", "&rthat allows you to smelt dusts", "&rinto ingots and create alloys.");
|
||||
public static final SlimefunItemStack IGNITION_CHAMBER = new SlimefunItemStack("IGNITION_CHAMBER", Material.DROPPER, "&4Automatic Ignition Chamber", "", "&rPrevents the Smeltery from using up fire.", "&rJust fill it up with \"Flint and Steel\"", "&rand place it adjacent to the Smeltery's dispenser");
|
||||
public static final SlimefunItemStack ORE_CRUSHER = new SlimefunItemStack("ORE_CRUSHER", Material.DISPENSER, "&bOre Crusher", "", "&aCrushes ores to double them");
|
||||
@ -523,7 +525,7 @@ public final class SlimefunItems {
|
||||
public static final SlimefunItemStack PRESSURE_CHAMBER = new SlimefunItemStack("PRESSURE_CHAMBER", Material.GLASS, "&bPressure Chamber", "", "&aCompresses Items even further");
|
||||
public static final SlimefunItemStack MAGIC_WORKBENCH = new SlimefunItemStack("MAGIC_WORKBENCH", Material.CRAFTING_TABLE, "&6Magic Workbench", "", "&dInfuses Items with magical Energy");
|
||||
public static final SlimefunItemStack ORE_WASHER = new SlimefunItemStack("ORE_WASHER", Material.CAULDRON, "&6Ore Washer", "", "&aWashes Sifted Ore to filter Ores", "&aand gives you small Stone Chunks");
|
||||
public static final SlimefunItemStack 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)");
|
||||
public static final SlimefunItemStack TABLE_SAW;
|
||||
public static final SlimefunItemStack COMPOSTER = new SlimefunItemStack("COMPOSTER", Material.CAULDRON, "&aComposter", "", "&a&oCan convert various Materials over Time...");
|
||||
public static final SlimefunItemStack ENHANCED_CRAFTING_TABLE = new SlimefunItemStack("ENHANCED_CRAFTING_TABLE", Material.CRAFTING_TABLE, "&eEnhanced Crafting Table", "", "&aA regular Crafting Table cannot", "&ahold this massive Amount of Power...");
|
||||
public static final SlimefunItemStack CRUCIBLE = new SlimefunItemStack("CRUCIBLE", Material.CAULDRON, "&cCrucible", "", "&a&oUsed to smelt Items into Liquids");
|
||||
@ -604,7 +606,7 @@ public final class SlimefunItems {
|
||||
public static final ItemStack ELECTRIC_ORE_GRINDER = new SlimefunItemStack("ELECTRIC_ORE_GRINDER", Material.FURNACE, "&cElectric Ore Grinder", "", "&rWorks as an Ore Crusher and Grind Stone", "", LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE), "&8\u21E8 &7Speed: 1x", LoreBuilder.powerPerSecond(12));
|
||||
public static final ItemStack ELECTRIC_ORE_GRINDER_2 = new SlimefunItemStack("ELECTRIC_ORE_GRINDER_2", Material.FURNACE, "&cElectric Ore Grinder &7(&eII&7)", "", "&rWorks as an Ore Crusher and Grind Stone", "", LoreBuilder.machine(MachineTier.END_GAME, MachineType.MACHINE), "&8\u21E8 &7Speed: 4x", LoreBuilder.powerPerSecond(30));
|
||||
public static final ItemStack ELECTRIC_INGOT_PULVERIZER = new SlimefunItemStack("ELECTRIC_INGOT_PULVERIZER", Material.FURNACE, "&cElectric Ingot Pulverizer", "", "&rPulverizes Ingots into Dust", "", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.MACHINE), "&8\u21E8 &7Speed: 1x", LoreBuilder.powerPerSecond(14));
|
||||
public static final ItemStack AUTO_DRIER = new SlimefunItemStack("AUTO_DRIER", Material.SMOKER, "&eAuto Drier", "", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.MACHINE), "&8\u21E8 &7Speed: 1x", LoreBuilder.powerPerSecond(10));
|
||||
public static final SlimefunItemStack AUTO_DRIER;
|
||||
public static final ItemStack AUTO_ENCHANTER = new SlimefunItemStack("AUTO_ENCHANTER", Material.ENCHANTING_TABLE, "&5Auto Enchanter", "", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.MACHINE), "&8\u21E8 &7Speed: 1x", LoreBuilder.powerPerSecond(18));
|
||||
public static final ItemStack AUTO_DISENCHANTER = new SlimefunItemStack("AUTO_DISENCHANTER", Material.ENCHANTING_TABLE, "&5Auto Disenchanter", "", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.MACHINE), "&8\u21E8 &7Speed: 1x", LoreBuilder.powerPerSecond(18));
|
||||
public static final ItemStack AUTO_ANVIL = new SlimefunItemStack("AUTO_ANVIL", Material.IRON_BLOCK, "&7Auto Anvil", "", LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE), "&8\u21E8 &7Repair Factor: 10%", LoreBuilder.powerPerSecond(24));
|
||||
@ -783,5 +785,16 @@ public final class SlimefunItems {
|
||||
|
||||
static {
|
||||
INFUSED_ELYTRA.addUnsafeEnchantment(Enchantment.MENDING, 1);
|
||||
|
||||
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", "", "&rImprovised version of the Smeltery", "&rthat only allows you to", "&rsmelt dusts into ingots");
|
||||
AUTO_DRIER = new SlimefunItemStack("AUTO_DRIER", Material.SMOKER, "&eAuto Drier", "", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.MACHINE), "&8\u21E8 &7Speed: 1x", LoreBuilder.powerPerSecond(10));
|
||||
}
|
||||
else {
|
||||
TABLE_SAW = null;
|
||||
MAKESHIFT_SMELTERY = new SlimefunItemStack("MAKESHIFT_SMELTERY", Material.FURNACE, "&eMakeshift Smeltery", "", "&rImprovised version of the Smeltery", "&rthat only allows you to", "&rsmelt dusts into ingots");
|
||||
AUTO_DRIER = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.events.ResearchUnlockEvent;
|
||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideSettings;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.options.SlimefunGuideSettings;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.setup.ResearchSetup;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.FireworkUtils;
|
||||
|
@ -281,7 +281,7 @@ public class SlimefunItem implements Placeable {
|
||||
if (!addon.hasDependency("Slimefun")) {
|
||||
throw new MissingDependencyException(addon, "Slimefun");
|
||||
}
|
||||
|
||||
|
||||
preRegister();
|
||||
|
||||
SlimefunItem conflicting = getByID(id);
|
||||
@ -359,13 +359,11 @@ public class SlimefunItem implements Placeable {
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (this instanceof VanillaItem) {
|
||||
state = ItemState.VANILLA;
|
||||
}
|
||||
else {
|
||||
if (this instanceof VanillaItem) {
|
||||
state = ItemState.VANILLA;
|
||||
}
|
||||
else {
|
||||
state = ItemState.DISABLED;
|
||||
}
|
||||
state = ItemState.DISABLED;
|
||||
}
|
||||
|
||||
postRegister();
|
||||
|
@ -299,12 +299,14 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
|
||||
}
|
||||
|
||||
// Looks like you are using an unsupported Minecraft Version
|
||||
getLogger().log(Level.SEVERE, "#############################################");
|
||||
getLogger().log(Level.SEVERE, "### Slimefun was not installed correctly!");
|
||||
getLogger().log(Level.SEVERE, "### You are using the wrong version of Minecraft!");
|
||||
getLogger().log(Level.SEVERE, "###");
|
||||
getLogger().log(Level.SEVERE, "### You are using Minecraft {0}", ReflectionUtils.getVersion());
|
||||
getLogger().log(Level.SEVERE, "### but Slimefun v{0} requires you to be using", getDescription().getVersion());
|
||||
getLogger().log(Level.SEVERE, "### Minecraft {0}", String.join(" / ", getSupportedVersions()));
|
||||
getLogger().log(Level.SEVERE, "#############################################");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -89,9 +89,10 @@ public class BlockStorage {
|
||||
Slimefun.getLogger().log(Level.INFO, "Loading Blocks for World \"" + w.getName() + "\"");
|
||||
Slimefun.getLogger().log(Level.INFO, "This may take a long time...");
|
||||
|
||||
File f = new File(PATH_BLOCKS + w.getName());
|
||||
if (f.exists()) {
|
||||
long total = f.listFiles().length;
|
||||
File dir = new File(PATH_BLOCKS + w.getName());
|
||||
|
||||
if (dir.exists()) {
|
||||
long total = dir.listFiles().length;
|
||||
long start = System.currentTimeMillis();
|
||||
long done = 0;
|
||||
long timestamp = System.currentTimeMillis();
|
||||
@ -99,7 +100,7 @@ public class BlockStorage {
|
||||
int delay = SlimefunPlugin.getCfg().getInt("URID.info-delay");
|
||||
|
||||
try {
|
||||
for (File file : f.listFiles()) {
|
||||
for (File file : dir.listFiles()) {
|
||||
if (file.getName().equals("null.sfb")) {
|
||||
Slimefun.getLogger().log(Level.WARNING, "Corrupted file detected!");
|
||||
Slimefun.getLogger().log(Level.WARNING, "Slimefun will simply skip this File, but you");
|
||||
@ -108,37 +109,43 @@ public class BlockStorage {
|
||||
}
|
||||
else if (file.getName().endsWith(".sfb")) {
|
||||
if (timestamp + delay < System.currentTimeMillis()) {
|
||||
Slimefun.getLogger().log(Level.INFO, "Loading Blocks... " + Math.round((((done * 100.0F) / total) * 100.0F) / 100.0F) + "% done (\"" + w.getName() + "\")");
|
||||
int progress = Math.round((((done * 100.0F) / total) * 100.0F) / 100.0F);
|
||||
Slimefun.getLogger().log(Level.INFO, "Loading Blocks... {0}% done (\"{1}\")", new Object[] { progress, w.getName() });
|
||||
timestamp = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
FileConfiguration cfg = YamlConfiguration.loadConfiguration(file);
|
||||
|
||||
for (String key : cfg.getKeys(false)) {
|
||||
Location l = deserializeLocation(key);
|
||||
String chunkString = locationToChunkString(l);
|
||||
|
||||
try {
|
||||
totalBlocks++;
|
||||
String json = cfg.getString(key);
|
||||
Config blockInfo = parseBlockInfo(l, json);
|
||||
if (blockInfo == null || !blockInfo.contains("id")) continue;
|
||||
if (storage.containsKey(l)) {
|
||||
// It should not be possible to have two blocks on the same location. Ignore the
|
||||
// new entry if a block is already present and print an error to the console.
|
||||
|
||||
Slimefun.getLogger().log(Level.INFO, "Ignoring duplicate block @ " + l.getBlockX() + ", " + l.getBlockY() + ", " + l.getBlockZ());
|
||||
Slimefun.getLogger().log(Level.INFO, "Old block data: {0}", serializeBlockInfo(storage.get(l)));
|
||||
Slimefun.getLogger().log(Level.INFO, "New block data ({0}): {1}", new Object[] { key, json });
|
||||
continue;
|
||||
}
|
||||
storage.put(l, blockInfo);
|
||||
if (blockInfo != null && blockInfo.contains("id")) {
|
||||
if (storage.containsKey(l)) {
|
||||
// It should not be possible to have two blocks on the same location. Ignore the
|
||||
// new entry if a block is already present and print an error to the console.
|
||||
|
||||
if (SlimefunPlugin.getRegistry().getTickerBlocks().contains(file.getName().replace(".sfb", ""))) {
|
||||
Set<Location> locations = SlimefunPlugin.getRegistry().getActiveTickers().getOrDefault(chunkString, new HashSet<>());
|
||||
locations.add(l);
|
||||
SlimefunPlugin.getRegistry().getActiveTickers().put(chunkString, locations);
|
||||
Slimefun.getLogger().log(Level.INFO, "Ignoring duplicate block @ " + l.getBlockX() + ", " + l.getBlockY() + ", " + l.getBlockZ());
|
||||
Slimefun.getLogger().log(Level.INFO, "Old block data: {0}", serializeBlockInfo(storage.get(l)));
|
||||
Slimefun.getLogger().log(Level.INFO, "New block data ({0}): {1}", new Object[] { key, json });
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!SlimefunPlugin.getRegistry().getActiveChunks().contains(chunkString)) {
|
||||
SlimefunPlugin.getRegistry().getActiveChunks().add(chunkString);
|
||||
storage.put(l, blockInfo);
|
||||
|
||||
if (SlimefunPlugin.getRegistry().getTickerBlocks().contains(file.getName().replace(".sfb", ""))) {
|
||||
Set<Location> locations = SlimefunPlugin.getRegistry().getActiveTickers().getOrDefault(chunkString, new HashSet<>());
|
||||
locations.add(l);
|
||||
SlimefunPlugin.getRegistry().getActiveTickers().put(chunkString, locations);
|
||||
|
||||
if (!SlimefunPlugin.getRegistry().getActiveChunks().contains(chunkString)) {
|
||||
SlimefunPlugin.getRegistry().getActiveChunks().add(chunkString);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -153,14 +160,16 @@ public class BlockStorage {
|
||||
finally {
|
||||
long time = (System.currentTimeMillis() - start);
|
||||
Slimefun.getLogger().log(Level.INFO, "Loading Blocks... 100% (FINISHED - {0}ms)", time);
|
||||
Slimefun.getLogger().log(Level.INFO, "Loaded a total of " + totalBlocks + " Blocks for World \"" + world.getName() + "\"");
|
||||
Slimefun.getLogger().log(Level.INFO, "Loaded a total of {0} Blocks for World \"{1}\"", new Object[] { totalBlocks, world.getName() });
|
||||
|
||||
if (totalBlocks > 0) {
|
||||
Slimefun.getLogger().log(Level.INFO, "Avg: {0}ms/Block", DoubleHandler.fixDouble((double) time / (double) totalBlocks, 3));
|
||||
}
|
||||
}
|
||||
}
|
||||
else f.mkdirs();
|
||||
else {
|
||||
dir.mkdirs();
|
||||
}
|
||||
|
||||
File chunks = new File(PATH_CHUNKS + "chunks.sfc");
|
||||
|
||||
|
@ -18,15 +18,15 @@ import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
||||
@Deprecated
|
||||
public interface GuideHandler {
|
||||
|
||||
public abstract void addEntry(List<String> texts, List<String> tooltips);
|
||||
void addEntry(List<String> texts, List<String> tooltips);
|
||||
|
||||
public abstract PlayerRunnable getRunnable();
|
||||
PlayerRunnable getRunnable();
|
||||
|
||||
public abstract int getTier();
|
||||
int getTier();
|
||||
|
||||
public abstract boolean trackHistory();
|
||||
boolean trackHistory();
|
||||
|
||||
public abstract int next(Player p, int index, ChestMenu menu);
|
||||
int next(Player p, int index, ChestMenu menu);
|
||||
|
||||
default PlayerRunnable getRunnable(boolean book) {
|
||||
return this.getRunnable();
|
||||
|
Loading…
Reference in New Issue
Block a user