mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
[CI skip] WIP Refactoring
This commit is contained in:
parent
f65563b28c
commit
af4de4fd10
4
.github/workflows/closed_issues.yml
vendored
4
.github/workflows/closed_issues.yml
vendored
@ -15,14 +15,14 @@ jobs:
|
||||
token: ${{ secrets.ACCESS_TOKEN }}
|
||||
max_commits: 20
|
||||
- name: Add label
|
||||
if: contains(toJson(steps.resolved.outputs.issues), github.event.issue.number)
|
||||
if: contains(steps.resolved.outputs.issues, github.event.issue.number)
|
||||
uses: maxkomarychev/octions/octions/issues/add-labels@master
|
||||
with:
|
||||
token: ${{ secrets.ACCESS_TOKEN }}
|
||||
issue_number: ${{ github.event.issue.number }}
|
||||
labels: 'Resolved'
|
||||
- uses: maxkomarychev/octions/octions/issues/create-comment@master
|
||||
if: contains(toJson(steps.resolved.outputs.issues), github.event.issue.number) == false
|
||||
if: contains(steps.resolved.outputs.issues, github.event.issue.number) == false
|
||||
with:
|
||||
token: ${{ secrets.ACCESS_TOKEN }}
|
||||
issue_number: ${{ github.event.issue.number }}
|
||||
|
@ -52,12 +52,17 @@
|
||||
* Added SlimefunGuide-Options API
|
||||
* Added ItemSettings API
|
||||
* Added experimental 1.13 backwards compatibility
|
||||
* Added "Magma Cream to Magma Blocks" recipe to the Electric Press
|
||||
* Added "Magma Blocks to Sulfate" recipe
|
||||
|
||||
#### Changes
|
||||
* Replaced GuideHandlers with FlexCategories
|
||||
* Removed support for old EmeraldEnchants versions
|
||||
|
||||
#### Fixes
|
||||
* Fixed error message when clicking empty slots in the Slimefun Guide
|
||||
* Fixed #1779
|
||||
* Fixed localized messages not showing in the book guide
|
||||
|
||||
## Release Candidate 10 (28 Mar 2020)
|
||||
|
||||
|
@ -31,7 +31,6 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockInfoConfig;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
import me.mrCookieSlime.Slimefun.api.GuideHandler;
|
||||
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
|
||||
import me.mrCookieSlime.Slimefun.api.inventory.UniversalBlockMenu;
|
||||
|
||||
@ -85,7 +84,6 @@ public class SlimefunRegistry {
|
||||
|
||||
private final Map<String, Set<Location>> activeTickers = new HashMap<>();
|
||||
|
||||
private final Map<Integer, List<GuideHandler>> guideHandlers = new HashMap<>();
|
||||
private final Map<String, ItemStack> automatedCraftingChamberRecipes = new HashMap<>();
|
||||
|
||||
public void load(Config cfg) {
|
||||
@ -231,18 +229,6 @@ public class SlimefunRegistry {
|
||||
return geoResources;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will soon be removed.
|
||||
*
|
||||
* @deprecated The {@link GuideHandler} API is deprecated. It will soon be removed.
|
||||
*
|
||||
* @return A Map of handlers
|
||||
*/
|
||||
@Deprecated
|
||||
public Map<Integer, List<GuideHandler>> getGuideHandlers() {
|
||||
return guideHandlers;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Map<String, ItemStack> getAutomatedCraftingChamberRecipes() {
|
||||
return automatedCraftingChamberRecipes;
|
||||
|
@ -0,0 +1,55 @@
|
||||
package io.github.thebusybiscuit.slimefun4.core.categories;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideLayout;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
|
||||
/**
|
||||
* A {@link FlexCategory} is a {@link Category} inside the {@link SlimefunGuide} that can
|
||||
* be completely modified.
|
||||
* It cannot hold any {@link SlimefunItem}.
|
||||
* It can be completely overridden to perform any action upon being opened.
|
||||
*
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
*/
|
||||
public abstract class FlexCategory extends Category {
|
||||
|
||||
public FlexCategory(NamespacedKey key, ItemStack item) {
|
||||
this(key, item, 3);
|
||||
}
|
||||
|
||||
public abstract boolean isVisible(Player p, PlayerProfile profile, SlimefunGuideLayout layout);
|
||||
|
||||
public abstract void open(Player p, PlayerProfile profile, SlimefunGuideLayout layout);
|
||||
|
||||
public FlexCategory(NamespacedKey key, ItemStack item, int tier) {
|
||||
super(key, item, tier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isHidden(Player p) {
|
||||
// We can stop this method right here.
|
||||
// We provide a custom method for this. See isVisible(...);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void add(SlimefunItem item) {
|
||||
throw new UnsupportedOperationException("You cannot add items to a FlexCategory!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public final List<SlimefunItem> getItems() {
|
||||
throw new UnsupportedOperationException("A FlexCategory has no items!");
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +1,17 @@
|
||||
package io.github.thebusybiscuit.slimefun4.core.guide;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.guide.BookSlimefunGuide;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.guide.ChestSlimefunGuide;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Research;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
/**
|
||||
* This interface is used for the different implementations that add behaviour
|
||||
@ -48,4 +53,18 @@ public interface SlimefunGuideImplementation {
|
||||
|
||||
void displayItem(PlayerProfile profile, SlimefunItem item, boolean addToHistory);
|
||||
|
||||
default void unlockItem(Player p, SlimefunItem sfitem, Runnable callback) {
|
||||
Research research = sfitem.getResearch();
|
||||
|
||||
if (p.getGameMode() == GameMode.CREATIVE && SlimefunPlugin.getRegistry().isFreeCreativeResearchingEnabled()) {
|
||||
research.unlock(p, true);
|
||||
Slimefun.runSync(callback, 5L);
|
||||
}
|
||||
else {
|
||||
research.unlock(p, false);
|
||||
p.setLevel(p.getLevel() - research.getCost());
|
||||
Slimefun.runSync(callback, 103L);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,29 @@
|
||||
package io.github.thebusybiscuit.slimefun4.core.services.plugins;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||
import io.github.thebusybiscuit.slimefun4.core.categories.FlexCategory;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideLayout;
|
||||
import me.mrCookieSlime.EmeraldEnchants.EnchantmentGuide;
|
||||
|
||||
class EmeraldEnchantsCategory extends FlexCategory {
|
||||
|
||||
public EmeraldEnchantsCategory(NamespacedKey key) {
|
||||
super(key, new CustomItem(Material.ENCHANTED_BOOK, "&2EmeraldEnchants &a(Enchantment Guide)"), 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open(Player p, PlayerProfile profile, SlimefunGuideLayout layout) {
|
||||
EnchantmentGuide.open(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible(Player p, PlayerProfile profile, SlimefunGuideLayout layout) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
package io.github.thebusybiscuit.slimefun4.core.services.plugins;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.PlayerRunnable;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
|
||||
import me.mrCookieSlime.EmeraldEnchants.EnchantmentGuide;
|
||||
import me.mrCookieSlime.Slimefun.api.GuideHandler;
|
||||
|
||||
// GuideHandler is deprecated and will be removed quite soon.
|
||||
// Now that this hook is in Slimefun vs. EmeraldEnchants, we can start deconstructing it.
|
||||
class EmeraldEnchantsHook implements GuideHandler {
|
||||
|
||||
private PlayerRunnable runnable;
|
||||
|
||||
public EmeraldEnchantsHook() {
|
||||
runnable = new PlayerRunnable(-1) {
|
||||
|
||||
@Override
|
||||
public void run(Player p) {
|
||||
EnchantmentGuide.open(p);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int next(Player p, int index, ChestMenu menu) {
|
||||
menu.addItem(index, new CustomItem(Material.ENCHANTED_BOOK, "&2EmeraldEnchants &a(Enchantment Guide)", "", "&a> Click to view a List of all custom Enchantments"));
|
||||
menu.addMenuClickHandler(index, (pl, slot, item, action) -> {
|
||||
EnchantmentGuide.open(p);
|
||||
return false;
|
||||
});
|
||||
|
||||
return index + 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEntry(List<String> text, List<String> tooltip) {
|
||||
text.add(ChatColor.translateAlternateColorCodes('&', "&2Enchantment Guide"));
|
||||
tooltip.add(ChatColor.translateAlternateColorCodes('&', "&aClick to open\n&aEmeraldEnchants' Enchantment Guide"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTier() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayerRunnable getRunnable() {
|
||||
return runnable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean trackHistory() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -1,18 +1,17 @@
|
||||
package io.github.thebusybiscuit.slimefun4.core.services.plugins;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
|
||||
import io.github.thebusybiscuit.slimefun4.core.categories.FlexCategory;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.GuideHandler;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
/**
|
||||
@ -51,11 +50,9 @@ public class ThirdPartyPluginService {
|
||||
|
||||
if (isPluginInstalled("EmeraldEnchants")) {
|
||||
isEmeraldEnchantsInstalled = true;
|
||||
|
||||
GuideHandler handler = new EmeraldEnchantsHook();
|
||||
List<GuideHandler> handlers = SlimefunPlugin.getRegistry().getGuideHandlers().getOrDefault(handler.getTier(), new ArrayList<>());
|
||||
handlers.add(handler);
|
||||
SlimefunPlugin.getRegistry().getGuideHandlers().put(handler.getTier(), handlers);
|
||||
Plugin emeraldEnchants = plugin.getServer().getPluginManager().getPlugin("EmeraldEnchants");
|
||||
FlexCategory category = new EmeraldEnchantsCategory(new NamespacedKey(emeraldEnchants, "enchantment_guide"));
|
||||
category.register();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,33 +1,33 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.guide;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
|
||||
import io.github.thebusybiscuit.cscorelib2.chat.json.ChatComponent;
|
||||
import io.github.thebusybiscuit.cscorelib2.chat.json.ClickEvent;
|
||||
import io.github.thebusybiscuit.cscorelib2.chat.json.CustomBookInterface;
|
||||
import io.github.thebusybiscuit.cscorelib2.chat.json.HoverEvent;
|
||||
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||
import io.github.thebusybiscuit.slimefun4.core.categories.FlexCategory;
|
||||
import io.github.thebusybiscuit.slimefun4.core.categories.SeasonalCategory;
|
||||
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.utils.ChatUtils;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.PlayerRunnable;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Chat.TellRawMessage;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Chat.TellRawMessage.HoverAction;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.CustomBookOverlay;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.LockedCategory;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Research;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.api.GuideHandler;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
public class BookSlimefunGuide implements SlimefunGuideImplementation {
|
||||
@ -42,124 +42,82 @@ public class BookSlimefunGuide implements SlimefunGuideImplementation {
|
||||
return new CustomItem(new ItemStack(Material.ENCHANTED_BOOK), "&aSlimefun Guide &7(Book GUI)", "", "&eRight Click &8\u21E8 &7Browse Items", "&eShift + Right Click &8\u21E8 &7Open Settings / Credits");
|
||||
}
|
||||
|
||||
private void openBook(Player p, List<ChatComponent> lines, boolean backButton) {
|
||||
CustomBookInterface book = new CustomBookInterface(SlimefunPlugin.instance);
|
||||
book.setTitle(SlimefunPlugin.getLocal().getMessage(p, "guide.title.main"));
|
||||
|
||||
for (int i = 0; i < lines.size(); i = i + 10) {
|
||||
ChatComponent page = new ChatComponent(ChatColors.color("&b&l- Slimefun Guide -\n\n"));
|
||||
|
||||
for (int j = i; j < lines.size() && j < i + 10; j++) {
|
||||
page.append(lines.get(j));
|
||||
}
|
||||
|
||||
page.append(new ChatComponent(""));
|
||||
|
||||
if (backButton) {
|
||||
ChatComponent button = new ChatComponent(ChatColor.GRAY + "\u21E6 " + SlimefunPlugin.getLocal().getMessage(p, "guide.back.title"));
|
||||
button.setHoverEvent(new HoverEvent(ChatColor.GRAY + "\u21E6 " + SlimefunPlugin.getLocal().getMessage(p, "guide.back.title"), "", ChatColor.GRAY + SlimefunPlugin.getLocal().getMessage(p, "guide.back.guide")));
|
||||
button.setClickEvent(new ClickEvent(SlimefunPlugin.instance, p, 10, player -> openMainMenu(PlayerProfile.get(player), 1)));
|
||||
page.append(button);
|
||||
}
|
||||
|
||||
book.addPage(page);
|
||||
}
|
||||
|
||||
book.open(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openMainMenu(PlayerProfile profile, int page) {
|
||||
Player p = profile.getPlayer();
|
||||
if (p == null) return;
|
||||
|
||||
List<TellRawMessage> pages = new ArrayList<>();
|
||||
List<String> texts = new ArrayList<>();
|
||||
List<String> tooltips = new ArrayList<>();
|
||||
List<PlayerRunnable> actions = new ArrayList<>();
|
||||
|
||||
List<ChatComponent> lines = new LinkedList<>();
|
||||
int tier = 0;
|
||||
|
||||
for (Category category : SlimefunPlugin.getRegistry().getEnabledCategories()) {
|
||||
boolean locked = true;
|
||||
|
||||
for (SlimefunItem item : category.getItems()) {
|
||||
if (Slimefun.isEnabled(p, item, false)) {
|
||||
locked = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!locked) {
|
||||
if (!category.isHidden(p) && (!(category instanceof FlexCategory) || ((FlexCategory) category).isVisible(p, profile, getLayout()))) {
|
||||
if (tier < category.getTier()) {
|
||||
for (GuideHandler handler : Slimefun.getGuideHandlers(tier)) {
|
||||
handler.addEntry(texts, tooltips);
|
||||
actions.add(new PlayerRunnable(2) {
|
||||
|
||||
@Override
|
||||
public void run(Player p) {
|
||||
handler.run(p, true, true);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
tier = category.getTier();
|
||||
|
||||
if (tier > 1) {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (texts.size() % 10 == 0) break;
|
||||
texts.add(" ");
|
||||
tooltips.add(null);
|
||||
actions.add(null);
|
||||
for (int i = 0; i < 10 && lines.size() % 10 != 0; i++) {
|
||||
lines.add(new ChatComponent("\n"));
|
||||
}
|
||||
}
|
||||
|
||||
texts.add(ChatColors.color("&8\u21E8 &6Tier " + tier));
|
||||
tooltips.add(null);
|
||||
actions.add(null);
|
||||
lines.add(new ChatComponent(ChatColor.DARK_GRAY + "\u21E8" + ChatColor.DARK_BLUE + " Tier " + tier + "\n"));
|
||||
}
|
||||
if (category instanceof LockedCategory && !((LockedCategory) category).hasUnlocked(p, profile)) {
|
||||
StringBuilder parents = new StringBuilder(ChatColors.color("&4&lLOCKED\n\n&7In order to unlock this Category,\n&7you need to unlock all Items from\n&7the following Categories first:\n"));
|
||||
List<String> lore = new LinkedList<>();
|
||||
lore.add(ChatColor.DARK_RED + SlimefunPlugin.getLocal().getMessage(p, "guide.locked") + " " + ChatColor.GRAY + "- " + ChatColor.RESET + category.getItem(p).getItemMeta().getDisplayName());
|
||||
lore.add("");
|
||||
|
||||
for (String line : SlimefunPlugin.getLocal().getMessages(p, "guide.locked-category")) {
|
||||
lore.add(ChatColor.RESET + line);
|
||||
}
|
||||
|
||||
lore.add("");
|
||||
|
||||
for (Category parent : ((LockedCategory) category).getParents()) {
|
||||
parents.append(ChatColors.color("\n&c" + ItemUtils.getItemName(parent.getItem(p))));
|
||||
lore.add(parent.getItem(p).getItemMeta().getDisplayName());
|
||||
}
|
||||
|
||||
texts.add(ChatColors.color(ChatUtils.crop(ChatColor.RED, ItemUtils.getItemName(category.getItem(p)))));
|
||||
tooltips.add(parents.toString());
|
||||
actions.add(null);
|
||||
ChatComponent chatComponent = new ChatComponent(ChatUtils.crop(ChatColor.RED, ItemUtils.getItemName(category.getItem(p)) + "\n"));
|
||||
chatComponent.setHoverEvent(new HoverEvent(lore.toArray(new String[0])));
|
||||
lines.add(chatComponent);
|
||||
}
|
||||
else if (category instanceof SeasonalCategory) {
|
||||
if (((SeasonalCategory) category).isVisible()) {
|
||||
texts.add(ChatColors.color(ChatUtils.crop(ChatColor.GREEN, ItemUtils.getItemName(category.getItem(p)))));
|
||||
tooltips.add(ChatColors.color("&eClick to open the following Category:\n" + ItemUtils.getItemName(category.getItem(p))));
|
||||
actions.add(new PlayerRunnable(1) {
|
||||
|
||||
@Override
|
||||
public void run(Player p) {
|
||||
Slimefun.runSync(() -> openCategory(profile, category, 1), 1L);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
texts.add(ChatColors.color(ChatUtils.crop(ChatColor.GREEN, ItemUtils.getItemName(category.getItem(p)))));
|
||||
tooltips.add(ChatColors.color("&eClick to open the following Category:\n" + ItemUtils.getItemName(category.getItem(p))));
|
||||
actions.add(new PlayerRunnable(1) {
|
||||
|
||||
@Override
|
||||
public void run(Player p) {
|
||||
Slimefun.runSync(() -> openCategory(profile, category, 1), 1L);
|
||||
}
|
||||
|
||||
});
|
||||
else if (!(category instanceof SeasonalCategory) || ((SeasonalCategory) category).isVisible()) {
|
||||
ChatComponent chatComponent = new ChatComponent(ChatUtils.crop(ChatColor.DARK_GREEN, ItemUtils.getItemName(category.getItem(p)) + "\n"));
|
||||
chatComponent.setHoverEvent(new HoverEvent(ItemUtils.getItemName(category.getItem(p)), "", ChatColor.GRAY + "\u21E8 " + ChatColor.GREEN + SlimefunPlugin.getLocal().getMessage(p, "guide.tooltips.open-category")));
|
||||
chatComponent.setClickEvent(new ClickEvent(SlimefunPlugin.instance, p, 10, pl -> openCategory(profile, category, 1)));
|
||||
lines.add(chatComponent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (GuideHandler handler : Slimefun.getGuideHandlers(tier)) {
|
||||
handler.addEntry(texts, tooltips);
|
||||
actions.add(new PlayerRunnable(2) {
|
||||
|
||||
@Override
|
||||
public void run(Player p) {
|
||||
handler.run(p, true, true);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
for (int i = 0; i < texts.size(); i = i + 10) {
|
||||
TellRawMessage pageMessage = new TellRawMessage();
|
||||
pageMessage.addText(ChatColors.color("&b&l- Slimefun Guide -\n\n"));
|
||||
|
||||
for (int j = i; j < texts.size() && j < i + 10; j++) {
|
||||
pageMessage.addText(texts.get(j) + "\n");
|
||||
|
||||
if (tooltips.get(j) != null) pageMessage.addHoverEvent(HoverAction.SHOW_TEXT, tooltips.get(j));
|
||||
if (actions.get(j) != null) pageMessage.addClickEvent(actions.get(j));
|
||||
}
|
||||
|
||||
pages.add(pageMessage);
|
||||
}
|
||||
|
||||
new CustomBookOverlay("Slimefun Guide", "TheBusyBiscuit", pages.toArray(new TellRawMessage[0])).open(p);
|
||||
openBook(p, lines, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -167,13 +125,13 @@ public class BookSlimefunGuide implements SlimefunGuideImplementation {
|
||||
Player p = profile.getPlayer();
|
||||
if (p == null) return;
|
||||
|
||||
if (category.getItems().size() < 250) {
|
||||
if (category instanceof FlexCategory) {
|
||||
((FlexCategory) category).open(p, profile, getLayout());
|
||||
}
|
||||
else if (category.getItems().size() < 250) {
|
||||
profile.getGuideHistory().add(category, page);
|
||||
|
||||
List<TellRawMessage> pages = new ArrayList<>();
|
||||
List<String> texts = new ArrayList<>();
|
||||
List<String> tooltips = new ArrayList<>();
|
||||
List<PlayerRunnable> actions = new ArrayList<>();
|
||||
List<ChatComponent> lines = new LinkedList<>();
|
||||
|
||||
for (SlimefunItem item : category.getItems()) {
|
||||
if (Slimefun.hasPermission(p, item, false)) {
|
||||
@ -181,96 +139,54 @@ public class BookSlimefunGuide implements SlimefunGuideImplementation {
|
||||
if (!Slimefun.hasUnlocked(p, item, false) && item.getResearch() != null) {
|
||||
Research research = item.getResearch();
|
||||
|
||||
texts.add(ChatColors.color(ChatUtils.crop(ChatColor.GRAY, item.getItemName())));
|
||||
tooltips.add(ChatColors.color(item.getItemName() + "\n&c&lLOCKED\n\n&7Cost: " + (p.getLevel() >= research.getCost() ? "&b" : "&4") + research.getCost() + " Levels\n\n&a> Click to unlock"));
|
||||
actions.add(new PlayerRunnable(2) {
|
||||
|
||||
@Override
|
||||
public void run(Player p) {
|
||||
ChatComponent component = new ChatComponent(ChatUtils.crop(ChatColor.RED, item.getItemName()) + "\n");
|
||||
component.setHoverEvent(new HoverEvent(ChatColor.RESET + item.getItemName(), ChatColor.DARK_RED.toString() + ChatColor.BOLD + SlimefunPlugin.getLocal().getMessage(p, "guide.locked"), "", ChatColor.GREEN + "> Click to unlock", "", ChatColor.GRAY + "Cost: " + ChatColor.AQUA.toString() + research.getCost() + " Level(s)"));
|
||||
component.setClickEvent(new ClickEvent(SlimefunPlugin.instance, p, 10, player -> {
|
||||
if (!SlimefunPlugin.getRegistry().getCurrentlyResearchingPlayers().contains(p.getUniqueId())) {
|
||||
if (research.canUnlock(p)) {
|
||||
if (profile.hasUnlocked(research)) {
|
||||
openCategory(profile, category, page);
|
||||
}
|
||||
else {
|
||||
if (!(p.getGameMode() == GameMode.CREATIVE && SlimefunPlugin.getRegistry().isFreeCreativeResearchingEnabled())) {
|
||||
p.setLevel(p.getLevel() - research.getCost());
|
||||
}
|
||||
|
||||
if (p.getGameMode() == GameMode.CREATIVE) {
|
||||
research.unlock(p, true);
|
||||
|
||||
Slimefun.runSync(() -> openCategory(profile, category, page), 1L);
|
||||
}
|
||||
else {
|
||||
research.unlock(p, false);
|
||||
Slimefun.runSync(() -> openCategory(profile, category, page), 103L);
|
||||
}
|
||||
unlockItem(p, item, () -> openCategory(profile, category, page));
|
||||
}
|
||||
}
|
||||
else SlimefunPlugin.getLocal().sendMessage(p, "messages.not-enough-xp", true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
lines.add(component);
|
||||
}
|
||||
else {
|
||||
texts.add(ChatColors.color(ChatUtils.crop(ChatColor.GREEN, item.getItemName())));
|
||||
ChatComponent component = new ChatComponent(ChatUtils.crop(ChatColor.DARK_GREEN, item.getItemName()) + "\n");
|
||||
|
||||
StringBuilder tooltip = new StringBuilder();
|
||||
tooltip.append(item.getItemName());
|
||||
List<String> lore = new ArrayList<>();
|
||||
lore.add(item.getItemName());
|
||||
|
||||
if (item.getItem().hasItemMeta() && item.getItem().getItemMeta().hasLore()) {
|
||||
for (String line : item.getItem().getItemMeta().getLore()) {
|
||||
tooltip.append('\n').append(line);
|
||||
}
|
||||
lore.addAll(item.getItem().getItemMeta().getLore());
|
||||
}
|
||||
|
||||
tooltip.append(ChatColors.color("\n\n&e&oClick for more Info"));
|
||||
|
||||
tooltips.add(tooltip.toString());
|
||||
actions.add(new PlayerRunnable(2) {
|
||||
|
||||
@Override
|
||||
public void run(Player p) {
|
||||
displayItem(profile, item, true);
|
||||
}
|
||||
|
||||
});
|
||||
component.setHoverEvent(new HoverEvent(lore.toArray(new String[0])));
|
||||
component.setClickEvent(new ClickEvent(SlimefunPlugin.instance, p, 10, player -> displayItem(profile, item, true)));
|
||||
lines.add(component);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
texts.add(ChatColors.color(ChatUtils.crop(ChatColor.DARK_RED, ItemUtils.getItemName(item.getItem()))));
|
||||
tooltips.add(ChatColors.color("&cNo Permission!"));
|
||||
actions.add(null);
|
||||
ChatComponent component = new ChatComponent(ChatUtils.crop(ChatColor.DARK_RED, ItemUtils.getItemName(item.getItem())) + "\n");
|
||||
|
||||
List<String> lore = new ArrayList<>();
|
||||
lore.add(ChatColor.DARK_RED + ChatColor.stripColor(ItemUtils.getItemName(item.getItem())));
|
||||
lore.add("");
|
||||
lore.addAll(SlimefunPlugin.getPermissionsService().getLore(item));
|
||||
|
||||
component.setHoverEvent(new HoverEvent(lore.toArray(new String[0])));
|
||||
lines.add(component);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < texts.size(); i = i + 10) {
|
||||
TellRawMessage pageMessage = new TellRawMessage();
|
||||
pageMessage.addText(ChatColors.color("&b&l- Slimefun Guide -\n\n"));
|
||||
|
||||
for (int j = i; j < texts.size() && j < i + 10; j++) {
|
||||
pageMessage.addText(texts.get(j) + "\n");
|
||||
if (tooltips.get(j) != null) pageMessage.addHoverEvent(HoverAction.SHOW_TEXT, tooltips.get(j));
|
||||
if (actions.get(j) != null) pageMessage.addClickEvent(actions.get(j));
|
||||
}
|
||||
|
||||
pageMessage.addText("\n");
|
||||
pageMessage.addText(ChatColors.color("&6\u21E6 &lBack"));
|
||||
pageMessage.addHoverEvent(HoverAction.SHOW_TEXT, ChatColors.color("&eClick to go back to the Category Overview"));
|
||||
pageMessage.addClickEvent(new PlayerRunnable(2) {
|
||||
|
||||
@Override
|
||||
public void run(Player p) {
|
||||
openMainMenu(profile, 1);
|
||||
}
|
||||
|
||||
});
|
||||
pages.add(pageMessage);
|
||||
}
|
||||
|
||||
new CustomBookOverlay("Slimefun Guide", "TheBusyBiscuit", pages.toArray(new TellRawMessage[0])).open(p);
|
||||
openBook(p, lines, true);
|
||||
}
|
||||
else {
|
||||
p.sendMessage(ChatColor.RED + "That Category is too big to open :/");
|
||||
|
@ -1,6 +1,11 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.guide;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideLayout;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
||||
|
||||
public class CheatSheetSlimefunGuide extends ChestSlimefunGuide {
|
||||
|
||||
@ -17,4 +22,13 @@ public class CheatSheetSlimefunGuide extends ChestSlimefunGuide {
|
||||
public SlimefunGuideLayout getLayout() {
|
||||
return SlimefunGuideLayout.CHEAT_SHEET;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createHeader(Player p, PlayerProfile profile, ChestMenu menu) {
|
||||
super.createHeader(p, profile, menu);
|
||||
|
||||
// Remove Settings Panel
|
||||
menu.addItem(1, ChestMenuUtils.getBackground());
|
||||
menu.addMenuClickHandler(1, ChestMenuUtils.getEmptyClickHandler());
|
||||
}
|
||||
}
|
||||
|
@ -5,10 +5,8 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.Tag;
|
||||
@ -27,6 +25,7 @@ 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;
|
||||
import io.github.thebusybiscuit.slimefun4.core.categories.FlexCategory;
|
||||
import io.github.thebusybiscuit.slimefun4.core.categories.SeasonalCategory;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.GuideHistory;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
|
||||
@ -44,7 +43,6 @@ import me.mrCookieSlime.Slimefun.Objects.LockedCategory;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Research;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.MultiBlockMachine;
|
||||
import me.mrCookieSlime.Slimefun.api.GuideHandler;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
@ -92,29 +90,22 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
ChestMenu menu = create(p);
|
||||
|
||||
List<Category> categories = SlimefunPlugin.getRegistry().getEnabledCategories();
|
||||
List<GuideHandler> handlers = SlimefunPlugin.getRegistry().getGuideHandlers().values().stream().flatMap(List::stream).collect(Collectors.toList());
|
||||
|
||||
int index = 9;
|
||||
int pages = (categories.size() + handlers.size() - 1) / CATEGORY_SIZE + 1;
|
||||
int pages = (categories.size() - 1) / CATEGORY_SIZE + 1;
|
||||
|
||||
createHeader(p, profile, menu);
|
||||
|
||||
int target = (CATEGORY_SIZE * (page - 1)) - 1;
|
||||
|
||||
while (target < (categories.size() + handlers.size() - 1) && index < CATEGORY_SIZE + 9) {
|
||||
while (target < (categories.size() - 1) && index < CATEGORY_SIZE + 9) {
|
||||
target++;
|
||||
|
||||
if (target >= categories.size()) {
|
||||
index = handlers.get(target - categories.size()).next(p, index, menu);
|
||||
}
|
||||
else {
|
||||
Category category = categories.get(target);
|
||||
|
||||
if (!category.isHidden(p) && displayCategory(menu, p, profile, category, index)) {
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
menu.addItem(46, ChestMenuUtils.getPreviousButton(p, page, pages));
|
||||
menu.addMenuClickHandler(46, (pl, slot, item, action) -> {
|
||||
@ -134,7 +125,10 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
}
|
||||
|
||||
private boolean displayCategory(ChestMenu menu, Player p, PlayerProfile profile, Category category, int index) {
|
||||
if (!(category instanceof LockedCategory)) {
|
||||
if (category instanceof FlexCategory) {
|
||||
return ((FlexCategory) category).isVisible(p, profile, getLayout());
|
||||
}
|
||||
else if (!(category instanceof LockedCategory)) {
|
||||
if (!(category instanceof SeasonalCategory) || ((SeasonalCategory) category).isVisible()) {
|
||||
menu.addItem(index, category.getItem(p));
|
||||
menu.addMenuClickHandler(index, (pl, slot, item, action) -> {
|
||||
@ -181,6 +175,11 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
Player p = profile.getPlayer();
|
||||
if (p == null) return;
|
||||
|
||||
if (category instanceof FlexCategory) {
|
||||
((FlexCategory) category).open(p, profile, getLayout());
|
||||
return;
|
||||
}
|
||||
|
||||
if (isSurvivalMode()) {
|
||||
profile.getGuideHistory().add(category, page);
|
||||
}
|
||||
@ -224,7 +223,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
|
||||
if (isSurvivalMode() && research != null && !profile.hasUnlocked(research)) {
|
||||
if (Slimefun.hasPermission(p, sfitem, false)) {
|
||||
menu.addItem(index, new CustomItem(Material.BARRIER, "&r" + ItemUtils.getItemName(sfitem.getItem()), "&4&l" + SlimefunPlugin.getLocal().getMessage(p, "guide.locked"), "", "&a> Click to unlock", "", "&7Cost: &b" + research.getCost() + " Level"));
|
||||
menu.addItem(index, new CustomItem(Material.BARRIER, "&r" + ItemUtils.getItemName(sfitem.getItem()), "&4&l" + SlimefunPlugin.getLocal().getMessage(p, "guide.locked"), "", "&a> Click to unlock", "", "&7Cost: &b" + research.getCost() + " Level(s)"));
|
||||
menu.addMenuClickHandler(index, (pl, slot, item, action) -> {
|
||||
if (!SlimefunPlugin.getRegistry().getCurrentlyResearchingPlayers().contains(pl.getUniqueId())) {
|
||||
if (research.canUnlock(pl)) {
|
||||
@ -232,18 +231,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
openCategory(profile, category, page);
|
||||
}
|
||||
else {
|
||||
if (!(pl.getGameMode() == GameMode.CREATIVE && SlimefunPlugin.getRegistry().isFreeCreativeResearchingEnabled())) {
|
||||
pl.setLevel(pl.getLevel() - research.getCost());
|
||||
}
|
||||
|
||||
if (pl.getGameMode() == GameMode.CREATIVE) {
|
||||
research.unlock(pl, SlimefunPlugin.getRegistry().isFreeCreativeResearchingEnabled());
|
||||
Slimefun.runSync(() -> openCategory(profile, category, page), 5L);
|
||||
}
|
||||
else {
|
||||
research.unlock(pl, false);
|
||||
Slimefun.runSync(() -> openCategory(profile, category, page), 103L);
|
||||
}
|
||||
unlockItem(pl, sfitem, () -> openCategory(profile, category, page));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -534,7 +522,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
menu.addItem(16, output, ChestMenuUtils.getEmptyClickHandler());
|
||||
}
|
||||
|
||||
private void createHeader(Player p, PlayerProfile profile, ChestMenu menu) {
|
||||
protected void createHeader(Player p, PlayerProfile profile, ChestMenu menu) {
|
||||
for (int i = 0; i < 9; i++) {
|
||||
menu.addItem(i, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler());
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ public abstract class ElectricPress extends AContainer implements RecipeDisplayI
|
||||
addRecipe(4, new ItemStack(Material.FLINT, 6), new ItemStack(Material.COBBLESTONE));
|
||||
addRecipe(5, new ItemStack(Material.GLASS), new ItemStack(Material.GLASS_PANE, 3));
|
||||
addRecipe(4, new ItemStack(Material.SNOWBALL, 4), new ItemStack(Material.SNOW_BLOCK));
|
||||
addRecipe(4, new ItemStack(Material.MAGMA_CREAM, 4), new ItemStack(Material.MAGMA_BLOCK));
|
||||
|
||||
addRecipe(6, SlimefunItems.COPPER_INGOT, new CustomItem(SlimefunItems.COPPER_WIRE, 3));
|
||||
addRecipe(16, new CustomItem(SlimefunItems.STEEL_INGOT, 8), SlimefunItems.STEEL_PLATE);
|
||||
|
@ -34,12 +34,22 @@ public class OreCrusher extends MultiBlockMachine {
|
||||
new ItemStack[] {
|
||||
new ItemStack(Material.COBBLESTONE, 8), new ItemStack(Material.SAND, 1),
|
||||
SlimefunItems.GOLD_4K, SlimefunItems.GOLD_DUST,
|
||||
new ItemStack(Material.GRAVEL), new ItemStack(Material.SAND)
|
||||
new ItemStack(Material.GRAVEL), new ItemStack(Material.SAND),
|
||||
new ItemStack(Material.MAGMA_BLOCK, 4), SlimefunItems.SULFATE
|
||||
},
|
||||
BlockFace.SELF
|
||||
);
|
||||
|
||||
addItemSetting(doubleOres);
|
||||
}
|
||||
|
||||
public boolean isDoubleDropsEnabled() {
|
||||
return doubleOres.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postRegister() {
|
||||
super.postRegister();
|
||||
|
||||
shownRecipes.addAll(Arrays.asList(
|
||||
new ItemStack(Material.COAL_ORE), new ItemStack(Material.COAL, isDoubleDropsEnabled() ? 2: 1),
|
||||
@ -50,10 +60,6 @@ public class OreCrusher extends MultiBlockMachine {
|
||||
));
|
||||
}
|
||||
|
||||
public boolean isDoubleDropsEnabled() {
|
||||
return doubleOres.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDisplayRecipes() {
|
||||
return recipes.stream().map(items -> items[0]).collect(Collectors.toList());
|
||||
|
@ -151,7 +151,7 @@ public class Category implements Keyed {
|
||||
* @return the list of SlimefunItems bound to this category
|
||||
*/
|
||||
public List<SlimefunItem> getItems() {
|
||||
return this.items;
|
||||
return items;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -166,7 +166,7 @@ public class Category implements Keyed {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Slimefun Category {" + key + ",tier=" + tier + "}";
|
||||
return getClass().getSimpleName() + " {" + key + ",tier=" + tier + "}";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,5 @@
|
||||
package me.mrCookieSlime.Slimefun.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ -59,12 +57,13 @@ public final class Slimefun {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Config instance of Items.yml file.
|
||||
* <p>
|
||||
* It calls {@code SlimefunStartup#getItemCfg()}.
|
||||
* Returns the {@link Config} instance of our Items.yml file.
|
||||
*
|
||||
* @deprecated Do not access this directly, use the {@link ItemSetting} API instead.
|
||||
*
|
||||
* @return the Items.yml Config instance.
|
||||
*/
|
||||
@Deprecated
|
||||
public static Config getItemConfig() {
|
||||
return SlimefunPlugin.getItemCfg();
|
||||
}
|
||||
@ -200,7 +199,10 @@ public final class Slimefun {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
if (message) SlimefunPlugin.getLocal().sendMessage(p, "messages.no-permission", true);
|
||||
if (message) {
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "messages.no-permission", true);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -240,7 +242,7 @@ public final class Slimefun {
|
||||
public static boolean isEnabled(Player p, SlimefunItem sfItem, boolean message) {
|
||||
if (sfItem.isDisabled()) {
|
||||
if (message) {
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "messages.disabled-in-world", true);
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "messages.disabled-item", true);
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -249,8 +251,12 @@ public final class Slimefun {
|
||||
String world = p.getWorld().getName();
|
||||
if (SlimefunPlugin.getWhitelist().contains(world + ".enabled")) {
|
||||
if (SlimefunPlugin.getWhitelist().getBoolean(world + ".enabled")) {
|
||||
if (!SlimefunPlugin.getWhitelist().contains(world + ".enabled-items." + sfItem.getID())) SlimefunPlugin.getWhitelist().setDefaultValue(world + ".enabled-items." + sfItem.getID(), true);
|
||||
if (SlimefunPlugin.getWhitelist().getBoolean(world + ".enabled-items." + sfItem.getID())) return true;
|
||||
if (!SlimefunPlugin.getWhitelist().contains(world + ".enabled-items." + sfItem.getID())) {
|
||||
SlimefunPlugin.getWhitelist().setDefaultValue(world + ".enabled-items." + sfItem.getID(), true);
|
||||
}
|
||||
if (SlimefunPlugin.getWhitelist().getBoolean(world + ".enabled-items." + sfItem.getID())) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
if (message) SlimefunPlugin.getLocal().sendMessage(p, "messages.disabled-in-world", true);
|
||||
return false;
|
||||
@ -264,20 +270,6 @@ public final class Slimefun {
|
||||
else return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will soon be removed.
|
||||
*
|
||||
* @deprecated The {@link GuideHandler} API is deprecated. It will soon be removed.
|
||||
*
|
||||
* @param tier
|
||||
* The tier
|
||||
* @return A list of handlers
|
||||
*/
|
||||
@Deprecated
|
||||
public static List<GuideHandler> getGuideHandlers(int tier) {
|
||||
return SlimefunPlugin.getRegistry().getGuideHandlers().getOrDefault(tier, new ArrayList<>());
|
||||
}
|
||||
|
||||
public static BukkitTask runSync(Runnable r) {
|
||||
return Bukkit.getScheduler().runTask(SlimefunPlugin.instance, r);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user