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

[CI skip] Updated language files and reduced technical debt

This commit is contained in:
TheBusyBiscuit 2020-02-13 01:30:27 +01:00
parent 14623e7378
commit 0ff1311c32
53 changed files with 454 additions and 441 deletions

View File

@ -0,0 +1,43 @@
package io.github.thebusybiscuit.slimefun4.api.events;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
public class PlayerLanguageChangeEvent extends Event {
private static final HandlerList handlers = new HandlerList();
private final Player player;
private final Language from;
private final Language to;
public PlayerLanguageChangeEvent(Player p, Language from, Language to) {
player = p;
this.from = from;
this.to = to;
}
public static HandlerList getHandlerList() {
return handlers;
}
public HandlerList getHandlers() {
return handlers;
}
public Player getPlayer() {
return player;
}
public Language getPreviousLanguage() {
return from;
}
public Language getNewLanguage() {
return to;
}
}

View File

@ -81,20 +81,20 @@ public class GPSNetwork {
} }
public void openTransmitterControlPanel(Player p) { public void openTransmitterControlPanel(Player p) {
ChestMenu menu = new ChestMenu("&9Control Panel"); ChestMenu menu = new ChestMenu(ChatColor.BLUE + SlimefunPlugin.getLocal().getMessage(p, "machines.GPS_CONTROL_PANEL.title"));
for (int slot : border) { for (int slot : border) {
menu.addItem(slot, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler()); menu.addItem(slot, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler());
} }
menu.addItem(2, new CustomItem(SlimefunItems.GPS_TRANSMITTER, "&7Transmitter Overview &e(Selected)")); menu.addItem(2, new CustomItem(SlimefunItems.GPS_TRANSMITTER, "&7" + SlimefunPlugin.getLocal().getMessage(p, "machines.GPS_CONTROL_PANEL.transmitters")));
menu.addMenuClickHandler(2, ChestMenuUtils.getEmptyClickHandler()); menu.addMenuClickHandler(2, ChestMenuUtils.getEmptyClickHandler());
int complexity = getNetworkComplexity(p.getUniqueId()); int complexity = getNetworkComplexity(p.getUniqueId());
menu.addItem(4, new CustomItem(SlimefunItems.GPS_CONTROL_PANEL, "&7Network Info", "", "&8\u21E8 &7Status: " + (complexity > 0 ? "&2&lONLINE": "&4&lOFFLINE"), "&8\u21E8 &7Complexity: &r" + complexity)); menu.addItem(4, new CustomItem(SlimefunItems.GPS_CONTROL_PANEL, "&7Network Info", "", "&8\u21E8 &7Status: " + (complexity > 0 ? "&2&lONLINE": "&4&lOFFLINE"), "&8\u21E8 &7Complexity: &r" + complexity));
menu.addMenuClickHandler(4, ChestMenuUtils.getEmptyClickHandler()); menu.addMenuClickHandler(4, ChestMenuUtils.getEmptyClickHandler());
menu.addItem(6, new CustomItem(worldIcon, "&7Waypoint Overview &r(Select)")); menu.addItem(6, new CustomItem(worldIcon, "&7" + SlimefunPlugin.getLocal().getMessage(p, "machines.GPS_CONTROL_PANEL.waypoints"), "", ChatColor.GRAY + "\u21E8 " + SlimefunPlugin.getLocal().getMessage(p, "guide.tooltips.open-category")));
menu.addMenuClickHandler(6, (pl, slot, item, action) -> { menu.addMenuClickHandler(6, (pl, slot, item, action) -> {
openWaypointControlPanel(pl); openWaypointControlPanel(pl);
return false; return false;
@ -136,13 +136,13 @@ public class GPSNetwork {
} }
public void openWaypointControlPanel(Player p) { public void openWaypointControlPanel(Player p) {
ChestMenu menu = new ChestMenu("&9Control Panel"); ChestMenu menu = new ChestMenu(ChatColor.BLUE + SlimefunPlugin.getLocal().getMessage(p, "machines.GPS_CONTROL_PANEL.title"));
for (int slot : border) { for (int slot : border) {
menu.addItem(slot, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler()); menu.addItem(slot, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler());
} }
menu.addItem(2, new CustomItem(SlimefunItems.GPS_TRANSMITTER, "&7Transmitter Overview &r(Select)")); menu.addItem(2, new CustomItem(SlimefunItems.GPS_TRANSMITTER, "&7" + SlimefunPlugin.getLocal().getMessage(p, "machines.GPS_CONTROL_PANEL.transmitters"), "", ChatColor.GRAY + "\u21E8 " + SlimefunPlugin.getLocal().getMessage(p, "guide.tooltips.open-category")));
menu.addMenuClickHandler(2, (pl, slot, item, action) -> { menu.addMenuClickHandler(2, (pl, slot, item, action) -> {
openTransmitterControlPanel(pl); openTransmitterControlPanel(pl);
return false; return false;
@ -152,7 +152,7 @@ public class GPSNetwork {
menu.addItem(4, new CustomItem(SlimefunItems.GPS_CONTROL_PANEL, "&7Network Info", "", "&8\u21E8 &7Status: " + (complexity > 0 ? "&2&lONLINE": "&4&lOFFLINE"), "&8\u21E8 &7Complexity: &r" + complexity)); menu.addItem(4, new CustomItem(SlimefunItems.GPS_CONTROL_PANEL, "&7Network Info", "", "&8\u21E8 &7Status: " + (complexity > 0 ? "&2&lONLINE": "&4&lOFFLINE"), "&8\u21E8 &7Complexity: &r" + complexity));
menu.addMenuClickHandler(4, ChestMenuUtils.getEmptyClickHandler()); menu.addMenuClickHandler(4, ChestMenuUtils.getEmptyClickHandler());
menu.addItem(6, new CustomItem(worldIcon, "&7Waypoint Overview &e(Selected)")); menu.addItem(6, new CustomItem(worldIcon, "&7" + SlimefunPlugin.getLocal().getMessage(p, "machines.GPS_CONTROL_PANEL.waypoints")));
menu.addMenuClickHandler(6, ChestMenuUtils.getEmptyClickHandler()); menu.addMenuClickHandler(6, ChestMenuUtils.getEmptyClickHandler());
int index = 0; int index = 0;

View File

@ -1,4 +1,4 @@
package me.mrCookieSlime.Slimefun.api.inventory; package io.github.thebusybiscuit.slimefun4.api.player;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -7,7 +7,7 @@ import org.bukkit.inventory.Inventory;
import io.github.thebusybiscuit.cscorelib2.config.Config; import io.github.thebusybiscuit.cscorelib2.config.Config;
import me.mrCookieSlime.Slimefun.api.PlayerProfile; import me.mrCookieSlime.Slimefun.api.PlayerProfile;
public class BackpackInventory { public class PlayerBackpack {
private final PlayerProfile profile; private final PlayerProfile profile;
private final int id; private final int id;
@ -19,7 +19,7 @@ public class BackpackInventory {
/** /**
* This constructor loads an existing Backpack * This constructor loads an existing Backpack
*/ */
public BackpackInventory(PlayerProfile profile, int id) { public PlayerBackpack(PlayerProfile profile, int id) {
this(profile, id, profile.getConfig().getInt("backpacks." + id + ".size")); this(profile, id, profile.getConfig().getInt("backpacks." + id + ".size"));
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
@ -30,7 +30,7 @@ public class BackpackInventory {
/** /**
* This constructor creates a new Backpack * This constructor creates a new Backpack
*/ */
public BackpackInventory(PlayerProfile profile, int id, int size) { public PlayerBackpack(PlayerProfile profile, int id, int size) {
this.profile = profile; this.profile = profile;
this.id = id; this.id = id;
this.cfg = profile.getConfig(); this.cfg = profile.getConfig();

View File

@ -0,0 +1,21 @@
package io.github.thebusybiscuit.slimefun4.core.attributes;
import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
public interface RecipeDisplayItem {
List<ItemStack> getDisplayRecipes();
default String getLabelLocalPath() {
return "guide.tooltips.recipes.machine";
}
default String getRecipeSectionLabel(Player p) {
return "&7\u21E9 " + SlimefunPlugin.getLocal().getMessage(p, getLabelLocalPath()) + " \u21E9";
}
}

View File

@ -40,32 +40,16 @@ public class ResearchCommand extends SubCommand {
if (player.isPresent()) { if (player.isPresent()) {
Player p = player.get(); Player p = player.get();
// Getting the PlayerProfile async
PlayerProfile.get(p, profile -> { PlayerProfile.get(p, profile -> {
if (args[2].equalsIgnoreCase("all")) { if (args[2].equalsIgnoreCase("all")) {
for (Research res : SlimefunPlugin.getRegistry().getResearches()) { researchAll(sender, profile, p);
if (!profile.hasUnlocked(res)) {
SlimefunPlugin.getLocal().sendMessage(sender, "messages.give-research", true, msg -> msg.replace(PLACEHOLDER_PLAYER, p.getName()).replace(PLACEHOLDER_RESEARCH, res.getName(p)));
}
res.unlock(p, true);
}
} }
else if (args[2].equalsIgnoreCase("reset")) { else if (args[2].equalsIgnoreCase("reset")) {
for (Research res : SlimefunPlugin.getRegistry().getResearches()) { reset(sender, profile, p);
profile.setResearched(res, false);
}
SlimefunPlugin.getLocal().sendMessage(p, "commands.research.reset", true, msg -> msg.replace(PLACEHOLDER_PLAYER, args[1]));
} }
else { else {
Optional<Research> research = getResearchFromString(args[2]); giveResearch(sender, profile, p, args[2]);
if (research.isPresent()) {
research.get().unlock(p, true);
SlimefunPlugin.getLocal().sendMessage(sender, "messages.give-research", true, msg -> msg.replace(PLACEHOLDER_PLAYER, p.getName()).replace(PLACEHOLDER_RESEARCH, research.get().getName(p)));
}
else {
SlimefunPlugin.getLocal().sendMessage(sender, "messages.not-valid-research", true, msg -> msg.replace(PLACEHOLDER_RESEARCH, args[2]));
}
} }
}); });
} }
@ -80,6 +64,36 @@ public class ResearchCommand extends SubCommand {
} }
} }
private void giveResearch(CommandSender sender, PlayerProfile profile, Player p, String input) {
Optional<Research> research = getResearchFromString(input);
if (research.isPresent()) {
research.get().unlock(p, true);
SlimefunPlugin.getLocal().sendMessage(sender, "messages.give-research", true, msg -> msg.replace(PLACEHOLDER_PLAYER, p.getName()).replace(PLACEHOLDER_RESEARCH, research.get().getName(p)));
}
else {
SlimefunPlugin.getLocal().sendMessage(sender, "messages.not-valid-research", true, msg -> msg.replace(PLACEHOLDER_RESEARCH, input));
}
}
private void researchAll(CommandSender sender, PlayerProfile profile, Player p) {
for (Research res : SlimefunPlugin.getRegistry().getResearches()) {
if (!profile.hasUnlocked(res)) {
SlimefunPlugin.getLocal().sendMessage(sender, "messages.give-research", true, msg -> msg.replace(PLACEHOLDER_PLAYER, p.getName()).replace(PLACEHOLDER_RESEARCH, res.getName(p)));
}
res.unlock(p, true);
}
}
private void reset(CommandSender sender, PlayerProfile profile, Player p) {
for (Research res : SlimefunPlugin.getRegistry().getResearches()) {
profile.setResearched(res, false);
}
SlimefunPlugin.getLocal().sendMessage(p, "commands.research.reset", true, msg -> msg.replace(PLACEHOLDER_PLAYER, p.getName()));
}
private Optional<Research> getResearchFromString(String input) { private Optional<Research> getResearchFromString(String input) {
if (!input.contains(":")) return Optional.empty(); if (!input.contains(":")) return Optional.empty();

View File

@ -22,6 +22,7 @@ import io.github.thebusybiscuit.cscorelib2.chat.ChatInput;
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils; import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem; import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.recipes.MinecraftRecipe; import io.github.thebusybiscuit.cscorelib2.recipes.MinecraftRecipe;
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils; import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils; import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu; import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
@ -34,7 +35,6 @@ import me.mrCookieSlime.Slimefun.Objects.LockedCategory;
import me.mrCookieSlime.Slimefun.Objects.Research; import me.mrCookieSlime.Slimefun.Objects.Research;
import me.mrCookieSlime.Slimefun.Objects.SeasonalCategory; import me.mrCookieSlime.Slimefun.Objects.SeasonalCategory;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.MultiBlockMachine; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.MultiBlockMachine;
import me.mrCookieSlime.Slimefun.api.GuideHandler; import me.mrCookieSlime.Slimefun.api.GuideHandler;
import me.mrCookieSlime.Slimefun.api.PlayerProfile; import me.mrCookieSlime.Slimefun.api.PlayerProfile;
@ -458,7 +458,7 @@ public class ChestSlimefunGuide implements ISlimefunGuide {
ChestMenu menu = create(p); ChestMenu menu = create(p);
if (item.hasWiki()) { if (item.hasWiki()) {
menu.addItem(8, new CustomItem(Material.KNOWLEDGE_BOOK, "&rView this Item on our Wiki &7(Slimefun Wiki)", "", "&7\u21E8 Click to open")); menu.addItem(8, new CustomItem(Material.KNOWLEDGE_BOOK, ChatColor.RESET + SlimefunPlugin.getLocal().getMessage("guide.tooltips.wiki"), "", ChatColor.GRAY + "\u21E8 " + ChatColor.GREEN + SlimefunPlugin.getLocal().getMessage(p, "guide.tooltips.open-category")));
menu.addMenuClickHandler(8, (pl, slot, itemstack, action) -> { menu.addMenuClickHandler(8, (pl, slot, itemstack, action) -> {
pl.closeInventory(); pl.closeInventory();
ChatUtils.sendURL(pl, item.getWiki()); ChatUtils.sendURL(pl, item.getWiki());
@ -581,7 +581,7 @@ public class ChestSlimefunGuide implements ISlimefunGuide {
if (page == 0) { if (page == 0) {
for (int i = 27; i < 36; i++) { for (int i = 27; i < 36; i++) {
menu.replaceExistingItem(i, new CustomItem(ChestMenuUtils.getBackground(), sfItem.getRecipeSectionLabel())); menu.replaceExistingItem(i, new CustomItem(ChestMenuUtils.getBackground(), sfItem.getRecipeSectionLabel(p)));
menu.addMenuClickHandler(i, ChestMenuUtils.getEmptyClickHandler()); menu.addMenuClickHandler(i, ChestMenuUtils.getEmptyClickHandler());
} }
} }

View File

@ -19,6 +19,7 @@ import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
import io.github.thebusybiscuit.cscorelib2.data.PersistentDataAPI; import io.github.thebusybiscuit.cscorelib2.data.PersistentDataAPI;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem; import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.skull.SkullItem; import io.github.thebusybiscuit.cscorelib2.skull.SkullItem;
import io.github.thebusybiscuit.slimefun4.api.events.PlayerLanguageChangeEvent;
import io.github.thebusybiscuit.slimefun4.core.services.github.Contributor; import io.github.thebusybiscuit.slimefun4.core.services.github.Contributor;
import io.github.thebusybiscuit.slimefun4.core.services.localization.Language; import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils; import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
@ -282,6 +283,7 @@ public final class GuideSettings {
Language defaultLanguage = SlimefunPlugin.getLocal().getDefaultLanguage(); Language defaultLanguage = SlimefunPlugin.getLocal().getDefaultLanguage();
menu.addItem(9, new CustomItem(defaultLanguage.getItem(), ChatColor.GRAY + SlimefunPlugin.getLocal().getMessage(p, "languages.default") + ChatColor.DARK_GRAY + " (" + defaultLanguage.getName(p) + ")", "", "&7\u21E8 &e" + SlimefunPlugin.getLocal().getMessage(p, "guide.languages.select-default")), menu.addItem(9, new CustomItem(defaultLanguage.getItem(), ChatColor.GRAY + SlimefunPlugin.getLocal().getMessage(p, "languages.default") + ChatColor.DARK_GRAY + " (" + defaultLanguage.getName(p) + ")", "", "&7\u21E8 &e" + SlimefunPlugin.getLocal().getMessage(p, "guide.languages.select-default")),
(pl, i, item, action) -> { (pl, i, item, action) -> {
SlimefunPlugin.instance.getServer().getPluginManager().callEvent(new PlayerLanguageChangeEvent(pl, SlimefunPlugin.getLocal().getLanguage(pl), defaultLanguage));
PersistentDataAPI.remove(pl, SlimefunPlugin.getLocal().getKey()); PersistentDataAPI.remove(pl, SlimefunPlugin.getLocal().getKey());
String name = SlimefunPlugin.getLocal().getMessage(p, "languages.default"); String name = SlimefunPlugin.getLocal().getMessage(p, "languages.default");
@ -300,6 +302,7 @@ public final class GuideSettings {
"", "",
"&7\u21E8 &e" + SlimefunPlugin.getLocal().getMessage(p, "guide.languages.select") "&7\u21E8 &e" + SlimefunPlugin.getLocal().getMessage(p, "guide.languages.select")
), (pl, i, item, action) -> { ), (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()); PersistentDataAPI.setString(pl, SlimefunPlugin.getLocal().getKey(), language.getID());
String name = language.getName(pl); String name = language.getName(pl);

View File

@ -16,6 +16,7 @@ public enum SupportedLanguage {
FINNISH("fi", "59f2349729a7ec8d4b1478adfe5ca8af96479e983fbad238ccbd81409b4ed"), FINNISH("fi", "59f2349729a7ec8d4b1478adfe5ca8af96479e983fbad238ccbd81409b4ed"),
NORWEGIAN("no", "e0596e165ec3f389b59cfdda93dd6e363e97d9c6456e7c2e123973fa6c5fda"), NORWEGIAN("no", "e0596e165ec3f389b59cfdda93dd6e363e97d9c6456e7c2e123973fa6c5fda"),
CZECH("cs", "48152b7334d7ecf335e47a4f35defbd2eb6957fc7bfe94212642d62f46e61e"), CZECH("cs", "48152b7334d7ecf335e47a4f35defbd2eb6957fc7bfe94212642d62f46e61e"),
ROMANIAN("ro", "dceb1708d5404ef326103e7b60559c9178f3dce729007ac9a0b498bdebe46107"),
PORTUGESE_PORTUGAL("pt", "ebd51f4693af174e6fe1979233d23a40bb987398e3891665fafd2ba567b5a53a"), PORTUGESE_PORTUGAL("pt", "ebd51f4693af174e6fe1979233d23a40bb987398e3891665fafd2ba567b5a53a"),
PORTUGESE_BRAZIL("pt-BR", "9a46475d5dcc815f6c5f2859edbb10611f3e861c0eb14f088161b3c0ccb2b0d9"), PORTUGESE_BRAZIL("pt-BR", "9a46475d5dcc815f6c5f2859edbb10611f3e861c0eb14f088161b3c0ccb2b0d9"),
HUNGARIAN("hu", "4a9c3c4b6c5031332dd2bfece5e31e999f8deff55474065cc86993d7bdcdbd0"), HUNGARIAN("hu", "4a9c3c4b6c5031332dd2bfece5e31e999f8deff55474065cc86993d7bdcdbd0"),
@ -26,10 +27,13 @@ public enum SupportedLanguage {
INDONESIAN("id", "5db2678ccaba7934412cb97ee16d416463a392574c5906352f18dea42895ee"), INDONESIAN("id", "5db2678ccaba7934412cb97ee16d416463a392574c5906352f18dea42895ee"),
CHINESE_CHINA("zh-CN", "7f9bc035cdc80f1ab5e1198f29f3ad3fdd2b42d9a69aeb64de990681800b98dc"), CHINESE_CHINA("zh-CN", "7f9bc035cdc80f1ab5e1198f29f3ad3fdd2b42d9a69aeb64de990681800b98dc"),
CHINESE_TAIWAN("zh-TW", "702a4afb2e1e2e3a1894a8b74272f95cfa994ce53907f9ac140bd3c932f9f"), CHINESE_TAIWAN("zh-TW", "702a4afb2e1e2e3a1894a8b74272f95cfa994ce53907f9ac140bd3c932f9f"),
JAPANESE("ja", "d640ae466162a47d3ee33c4076df1cab96f11860f07edb1f0832c525a9e33323"),
HEBREW("he", "1ba086a2cc7272cf5ba49c80248546c22e5ef1bab54120e8a8e5d9e75b6a"), HEBREW("he", "1ba086a2cc7272cf5ba49c80248546c22e5ef1bab54120e8a8e5d9e75b6a"),
ARABIC("ar", "a4be759a9cf7f0a19a7e8e62f23789ad1d21cebae38af9d9541676a3db001572"), ARABIC("ar", "a4be759a9cf7f0a19a7e8e62f23789ad1d21cebae38af9d9541676a3db001572"),
PERSIAN("fa", "5cd9badf1972583b663b44b1e027255de8f275aa1e89defcf77782ba6fcc652"),
AFRIKAANS("af", "961a1eacc10524d1f45f23b0e487bb2fc33948d9676b418b19a3da0b109d0e3c"), AFRIKAANS("af", "961a1eacc10524d1f45f23b0e487bb2fc33948d9676b418b19a3da0b109d0e3c"),
MALAY("ms", "754b9041dea6db6db44750f1385a743adf653767b4b8802cad4c585dd3f5be46"); MALAY("ms", "754b9041dea6db6db44750f1385a743adf653767b4b8802cad4c585dd3f5be46"),
THAI("th", "2a7916e4a852f7e6f3f3de19c7fb57686a37bce834bd54684a7dbef8d53fb");
private final String id; private final String id;
private final String textureHash; private final String textureHash;

View File

@ -10,7 +10,6 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.logging.Level;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -37,6 +36,8 @@ import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem; import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.skull.SkullBlock; import io.github.thebusybiscuit.cscorelib2.skull.SkullBlock;
import io.github.thebusybiscuit.cscorelib2.skull.SkullItem; import io.github.thebusybiscuit.cscorelib2.skull.SkullItem;
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import io.github.thebusybiscuit.slimefun4.utils.NumberUtils; import io.github.thebusybiscuit.slimefun4.utils.NumberUtils;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu; import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler; import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
@ -51,11 +52,9 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.UnregisterReason; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.UnregisterReason;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.InventoryBlock; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.InventoryBlock;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.Objects.handlers.BlockTicker; import me.mrCookieSlime.Slimefun.Objects.handlers.BlockTicker;
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager; import me.mrCookieSlime.Slimefun.Setup.SlimefunManager;
import me.mrCookieSlime.Slimefun.api.BlockStorage; import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.Slimefun;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu; import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset; import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
@ -217,8 +216,8 @@ public abstract class ProgrammableAndroid extends SimpleSlimefunItem<BlockTicker
} }
@Override @Override
public String getRecipeSectionLabel() { public String getLabelLocalPath() {
return "&7\u21E9 Available Types of Fuel \u21E9"; return "guide.tooltips.recipes.generator";
} }
@Override @Override
@ -477,10 +476,10 @@ public abstract class ProgrammableAndroid extends SimpleSlimefunItem<BlockTicker
private void constructMenu(BlockMenuPreset preset) { private void constructMenu(BlockMenuPreset preset) {
for (int i : border) { for (int i : border) {
preset.addItem(i, new CustomItem(new ItemStack(Material.GRAY_STAINED_GLASS_PANE), " "), (p, slot, item, action) -> false); preset.addItem(i, new CustomItem(new ItemStack(Material.GRAY_STAINED_GLASS_PANE), " "), ChestMenuUtils.getEmptyClickHandler());
} }
for (int i : border_out) { for (int i : border_out) {
preset.addItem(i, new CustomItem(new ItemStack(Material.ORANGE_STAINED_GLASS_PANE), " "), (p, slot, item, action) -> false); preset.addItem(i, new CustomItem(new ItemStack(Material.ORANGE_STAINED_GLASS_PANE), " "), ChestMenuUtils.getEmptyClickHandler());
} }
for (int i : getOutputSlots()) { for (int i : getOutputSlots()) {
@ -498,19 +497,21 @@ public abstract class ProgrammableAndroid extends SimpleSlimefunItem<BlockTicker
}); });
} }
ItemStack generator = SkullItem.fromBase64("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTM0M2NlNThkYTU0Yzc5OTI0YTJjOTMzMWNmYzQxN2ZlOGNjYmJlYTliZTQ1YTdhYzg1ODYwYTZjNzMwIn19fQ==");
if (getTier() == 1) { if (getTier() == 1) {
preset.addItem(34, new CustomItem(SkullItem.fromBase64("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTM0M2NlNThkYTU0Yzc5OTI0YTJjOTMzMWNmYzQxN2ZlOGNjYmJlYTliZTQ1YTdhYzg1ODYwYTZjNzMwIn19fQ=="), "&8\u21E9 &cFuel Input &8\u21E9", "", "&rThis Android runs on solid Fuel", "&re.g. Coal, Wood, etc..."), (p, slot, item, action) -> false); preset.addItem(34, new CustomItem(generator, "&8\u21E9 &cFuel Input &8\u21E9", "", "&rThis Android runs on solid Fuel", "&re.g. Coal, Wood, etc..."), ChestMenuUtils.getEmptyClickHandler());
} }
else if (getTier() == 2){ else if (getTier() == 2) {
preset.addItem(34, new CustomItem(SkullItem.fromBase64("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTM0M2NlNThkYTU0Yzc5OTI0YTJjOTMzMWNmYzQxN2ZlOGNjYmJlYTliZTQ1YTdhYzg1ODYwYTZjNzMwIn19fQ=="), "&8\u21E9 &cFuel Input &8\u21E9", "", "&rThis Android runs on liquid Fuel", "&re.g. Lava, Oil, Fuel, etc..."), (p, slot, item, action) -> false); preset.addItem(34, new CustomItem(generator, "&8\u21E9 &cFuel Input &8\u21E9", "", "&rThis Android runs on liquid Fuel", "&re.g. Lava, Oil, Fuel, etc..."), ChestMenuUtils.getEmptyClickHandler());
} }
else { else {
preset.addItem(34, new CustomItem(SkullItem.fromBase64("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTM0M2NlNThkYTU0Yzc5OTI0YTJjOTMzMWNmYzQxN2ZlOGNjYmJlYTliZTQ1YTdhYzg1ODYwYTZjNzMwIn19fQ=="), "&8\u21E9 &cFuel Input &8\u21E9", "", "&rThis Android runs on radioactive Fuel", "&re.g. Uranium, Neptunium or Boosted Uranium"), (p, slot, item, action) -> false); preset.addItem(34, new CustomItem(generator, "&8\u21E9 &cFuel Input &8\u21E9", "", "&rThis Android runs on radioactive Fuel", "&re.g. Uranium, Neptunium or Boosted Uranium"), ChestMenuUtils.getEmptyClickHandler());
} }
} }
public void openScriptEditor(Player p, Block b) { public void openScriptEditor(Player p, Block b) {
ChestMenu menu = new ChestMenu("&eScript Editor"); ChestMenu menu = new ChestMenu(ChatColor.DARK_AQUA + SlimefunPlugin.getLocal().getMessage(p, "android.scripts.editor"));
menu.addItem(1, new CustomItem(SkullItem.fromBase64("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDliZjZkYjRhZWRhOWQ4ODIyYjlmNzM2NTM4ZThjMThiOWE0ODQ0Zjg0ZWI0NTUwNGFkZmJmZWU4N2ViIn19fQ=="), "&2> Edit Script", "", "&aEdits your current Script")); menu.addItem(1, new CustomItem(SkullItem.fromBase64("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDliZjZkYjRhZWRhOWQ4ODIyYjlmNzM2NTM4ZThjMThiOWE0ODQ0Zjg0ZWI0NTUwNGFkZmJmZWU4N2ViIn19fQ=="), "&2> Edit Script", "", "&aEdits your current Script"));
menu.addMenuClickHandler(1, (pl, slot, item, action) -> { menu.addMenuClickHandler(1, (pl, slot, item, action) -> {
@ -540,7 +541,7 @@ public abstract class ProgrammableAndroid extends SimpleSlimefunItem<BlockTicker
} }
public void openScript(Player p, Block b, String script) { public void openScript(Player p, Block b, String script) {
ChestMenu menu = new ChestMenu("&eScript Editor"); ChestMenu menu = new ChestMenu(ChatColor.DARK_AQUA + SlimefunPlugin.getLocal().getMessage(p, "android.scripts.editor"));
String[] commands = script.split("-"); String[] commands = script.split("-");
menu.addItem(0, new CustomItem(ScriptPart.START.getItem(), SlimefunPlugin.getLocal().getMessage(p, "android.scripts.instructions.START"), "", "&7\u21E8 &eLeft Click &7to return to the Android's interface")); menu.addItem(0, new CustomItem(ScriptPart.START.getItem(), SlimefunPlugin.getLocal().getMessage(p, "android.scripts.instructions.START"), "", "&7\u21E8 &eLeft Click &7to return to the Android's interface"));
@ -794,14 +795,11 @@ public abstract class ProgrammableAndroid extends SimpleSlimefunItem<BlockTicker
} }
protected void openScriptComponentEditor(Player p, Block b, String script, int index) { protected void openScriptComponentEditor(Player p, Block b, String script, int index) {
ChestMenu menu = new ChestMenu("&eScript Editor"); ChestMenu menu = new ChestMenu(ChatColor.DARK_AQUA + SlimefunPlugin.getLocal().getMessage(p, "android.scripts.editor"));
String[] commands = script.split("-"); String[] commands = script.split("-");
for (int i = 0; i < 9; i++) { ChestMenuUtils.drawBackground(menu, 0, 1, 2, 3, 4, 5, 6, 7, 8);
menu.addItem(i, new CustomItem(new ItemStack(Material.GRAY_STAINED_GLASS_PANE), " "), (pl, slot, item, action) -> false);
}
try {
menu.addItem(9, new CustomItem(SkullItem.fromBase64("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTYxMzlmZDFjNTY1NGU1NmU5ZTRlMmM4YmU3ZWIyYmQ1YjQ5OWQ2MzM2MTY2NjNmZWVlOTliNzQzNTJhZDY0In19fQ=="), "&rDo nothing"), (pl, slot, item, action) -> { menu.addItem(9, new CustomItem(SkullItem.fromBase64("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTYxMzlmZDFjNTY1NGU1NmU5ZTRlMmM4YmU3ZWIyYmQ1YjQ5OWQ2MzM2MTY2NjNmZWVlOTliNzQzNTJhZDY0In19fQ=="), "&rDo nothing"), (pl, slot, item, action) -> {
int i = 0; int i = 0;
StringBuilder builder = new StringBuilder("START-"); StringBuilder builder = new StringBuilder("START-");
@ -817,10 +815,6 @@ public abstract class ProgrammableAndroid extends SimpleSlimefunItem<BlockTicker
openScript(p, b, builder.toString()); openScript(p, b, builder.toString());
return false; return false;
}); });
}
catch (Exception x) {
Slimefun.getLogger().log(Level.SEVERE, "An Error occured while creating the Script Editor for Slimefun " + SlimefunPlugin.getVersion(), x);
}
int i = 10; int i = 10;
for (ScriptPart part : getAccessibleScriptParts()) { for (ScriptPart part : getAccessibleScriptParts()) {

View File

@ -11,11 +11,11 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta; import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import io.github.thebusybiscuit.slimefun4.api.player.PlayerBackpack;
import me.mrCookieSlime.Slimefun.SlimefunPlugin; import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems; import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager; import me.mrCookieSlime.Slimefun.Setup.SlimefunManager;
import me.mrCookieSlime.Slimefun.api.PlayerProfile; import me.mrCookieSlime.Slimefun.api.PlayerProfile;
import me.mrCookieSlime.Slimefun.api.inventory.BackpackInventory;
public class CoolerListener implements Listener { public class CoolerListener implements Listener {
@ -30,7 +30,7 @@ public class CoolerListener implements Listener {
for (ItemStack item : p.getInventory().getContents()) { for (ItemStack item : p.getInventory().getContents()) {
if (SlimefunManager.isItemSimilar(item, SlimefunItems.COOLER, false)) { if (SlimefunManager.isItemSimilar(item, SlimefunItems.COOLER, false)) {
BackpackInventory backpack = PlayerProfile.getBackpack(item); PlayerBackpack backpack = PlayerProfile.getBackpack(item);
if (backpack != null) { if (backpack != null) {
Inventory inv = backpack.getInventory(); Inventory inv = backpack.getInventory();

View File

@ -68,19 +68,10 @@ public class MultiBlockListener implements Listener {
} }
protected boolean compareMaterialsVertical(Block b, Material top, Material center, Material bottom) { protected boolean compareMaterialsVertical(Block b, Material top, Material center, Material bottom) {
if (center != null && !equals(b.getType(), center)) { return
return false; (center == null || equals(b.getType(), center)) &&
} (top == null || equals(b.getRelative(BlockFace.UP).getType(), top)) &&
(bottom == null || equals(b.getRelative(BlockFace.DOWN).getType(), bottom));
if (top != null && !equals(b.getRelative(BlockFace.UP).getType(), top)) {
return false;
}
if (bottom != null && !equals(b.getRelative(BlockFace.DOWN).getType(), bottom)) {
return false;
}
return true;
} }
private boolean equals(Material a, Material b) { private boolean equals(Material a, Material b) {

View File

@ -2,6 +2,7 @@ package io.github.thebusybiscuit.slimefun4.implementation.listeners;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.Set; import java.util.Set;
@ -42,6 +43,8 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
public class TalismanListener implements Listener { public class TalismanListener implements Listener {
private final int[] armorSlots = {39, 38, 37, 36};
public TalismanListener(SlimefunPlugin plugin) { public TalismanListener(SlimefunPlugin plugin) {
plugin.getServer().getPluginManager().registerEvents(this, plugin); plugin.getServer().getPluginManager().registerEvents(this, plugin);
} }
@ -71,8 +74,6 @@ public class TalismanListener implements Listener {
} }
} }
private final int[] armorSlots = {39, 38, 37, 36};
@EventHandler @EventHandler
public void onItemBreak(PlayerItemBreakEvent e) { public void onItemBreak(PlayerItemBreakEvent e) {
if (Talisman.checkFor(e, (SlimefunItemStack) SlimefunItems.TALISMAN_ANVIL)) { if (Talisman.checkFor(e, (SlimefunItemStack) SlimefunItems.TALISMAN_ANVIL)) {
@ -115,7 +116,8 @@ public class TalismanListener implements Listener {
Random random = ThreadLocalRandom.current(); Random random = ThreadLocalRandom.current();
if (Talisman.checkFor(e, (SlimefunItemStack) SlimefunItems.TALISMAN_MAGICIAN)) { if (Talisman.checkFor(e, (SlimefunItemStack) SlimefunItems.TALISMAN_MAGICIAN)) {
List<String> enchantments = new ArrayList<>(); List<String> enchantments = new LinkedList<>();
for (Enchantment en : Enchantment.values()) { for (Enchantment en : Enchantment.values()) {
for (int i = 1; i <= en.getMaxLevel(); i++) { for (int i = 1; i <= en.getMaxLevel(); i++) {
if ((boolean) Slimefun.getItemValue("MAGICIAN_TALISMAN", "allow-enchantments." + en.getKey().getKey() + ".level." + i) && en.canEnchantItem(e.getItem())) { if ((boolean) Slimefun.getItemValue("MAGICIAN_TALISMAN", "allow-enchantments." + en.getKey().getKey() + ".level." + i) && en.canEnchantItem(e.getItem())) {
@ -123,19 +125,21 @@ public class TalismanListener implements Listener {
} }
} }
} }
String enchant = enchantments.get(random.nextInt(enchantments.size())); String enchant = enchantments.get(random.nextInt(enchantments.size()));
e.getEnchantsToAdd().put(Enchantment.getByKey(NamespacedKey.minecraft(enchant.split("-")[0])), Integer.parseInt(enchant.split("-")[1])); e.getEnchantsToAdd().put(Enchantment.getByKey(NamespacedKey.minecraft(enchant.split("-")[0])), Integer.parseInt(enchant.split("-")[1]));
} }
if (!e.getEnchantsToAdd().containsKey(Enchantment.SILK_TOUCH) && Enchantment.LOOT_BONUS_BLOCKS.canEnchantItem(e.getItem()) && Talisman.checkFor(e, (SlimefunItemStack) SlimefunItems.TALISMAN_WIZARD)) { if (!e.getEnchantsToAdd().containsKey(Enchantment.SILK_TOUCH) && Enchantment.LOOT_BONUS_BLOCKS.canEnchantItem(e.getItem()) && Talisman.checkFor(e, (SlimefunItemStack) SlimefunItems.TALISMAN_WIZARD)) {
if (e.getEnchantsToAdd().containsKey(Enchantment.LOOT_BONUS_BLOCKS)) e.getEnchantsToAdd().remove(Enchantment.LOOT_BONUS_BLOCKS);
Set<Enchantment> enchantments = e.getEnchantsToAdd().keySet(); Set<Enchantment> enchantments = e.getEnchantsToAdd().keySet();
for (Enchantment en : enchantments) { for (Enchantment en : enchantments) {
if (random.nextInt(100) < 40) e.getEnchantsToAdd().put(en, random.nextInt(3) + 1); if (random.nextInt(100) < 40) {
e.getEnchantsToAdd().put(en, random.nextInt(3) + 1);
}
} }
e.getItem().addUnsafeEnchantment(Enchantment.LOOT_BONUS_BLOCKS, random.nextInt(3) + 3); e.getEnchantsToAdd().put(Enchantment.LOOT_BONUS_BLOCKS, random.nextInt(3) + 3);
} }
} }

View File

@ -34,11 +34,7 @@ public class TeleporterListener implements Listener {
if (id.equals("GPS_ACTIVATION_DEVICE_SHARED") || (id.equals("GPS_ACTIVATION_DEVICE_PERSONAL") && BlockStorage.getLocationInfo(e.getClickedBlock().getLocation(), "owner").equals(e.getPlayer().getUniqueId().toString()))) { if (id.equals("GPS_ACTIVATION_DEVICE_SHARED") || (id.equals("GPS_ACTIVATION_DEVICE_PERSONAL") && BlockStorage.getLocationInfo(e.getClickedBlock().getLocation(), "owner").equals(e.getPlayer().getUniqueId().toString()))) {
SlimefunItem teleporter = BlockStorage.check(e.getClickedBlock().getRelative(BlockFace.DOWN)); SlimefunItem teleporter = BlockStorage.check(e.getClickedBlock().getRelative(BlockFace.DOWN));
if (teleporter instanceof Teleporter) { if (teleporter instanceof Teleporter && checkForPylons(e.getClickedBlock().getRelative(BlockFace.DOWN))) {
for (BlockFace face : faces) {
if (!BlockStorage.check(e.getClickedBlock().getRelative(BlockFace.DOWN).getRelative(face), "GPS_TELEPORTER_PYLON")) return;
}
Block block = e.getClickedBlock().getRelative(BlockFace.DOWN); Block block = e.getClickedBlock().getRelative(BlockFace.DOWN);
UUID owner = UUID.fromString(BlockStorage.getLocationInfo(block.getLocation(), "owner")); UUID owner = UUID.fromString(BlockStorage.getLocationInfo(block.getLocation(), "owner"));
SlimefunPlugin.getGPSNetwork().getTeleleportationService().openTeleporterGUI(e.getPlayer(), owner, block, SlimefunPlugin.getGPSNetwork().getNetworkComplexity(owner)); SlimefunPlugin.getGPSNetwork().getTeleleportationService().openTeleporterGUI(e.getPlayer(), owner, block, SlimefunPlugin.getGPSNetwork().getNetworkComplexity(owner));
@ -49,4 +45,14 @@ public class TeleporterListener implements Listener {
} }
} }
private boolean checkForPylons(Block teleporter) {
for (BlockFace face : faces) {
if (!BlockStorage.check(teleporter.getRelative(face), "GPS_TELEPORTER_PYLON")) {
return false;
}
}
return true;
}
} }

View File

@ -16,8 +16,6 @@ import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.block.Chest; import org.bukkit.block.Chest;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -62,6 +60,12 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunMachine;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SoulboundItem; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SoulboundItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.Talisman; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.Talisman;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.VanillaItem; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.VanillaItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.blocks.AncientPedestal;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.blocks.HologramProjector;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.blocks.InfusedHopper;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.blocks.ReactorAccessPort;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.blocks.RepairedSpawner;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.blocks.TrashCan;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.cargo.AdvancedCargoOutputNode; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.cargo.AdvancedCargoOutputNode;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.cargo.CargoConnector; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.cargo.CargoConnector;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.cargo.CargoInputNode; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.cargo.CargoInputNode;
@ -110,15 +114,10 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.items.TelepositionScroll;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.items.Vitamins; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.items.Vitamins;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.items.WaterStaff; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.items.WaterStaff;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.items.WindStaff; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.items.WindStaff;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.AncientPedestal;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.BlockPlacer; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.BlockPlacer;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.Composter; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.Composter;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.Crucible; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.Crucible;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.EnhancedFurnace; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.EnhancedFurnace;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.HologramProjector;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.InfusedHopper;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.ReactorAccessPort;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.TrashCan;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.electric.AnimalGrowthAccelerator; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.electric.AnimalGrowthAccelerator;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.electric.AutoAnvil; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.electric.AutoAnvil;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.electric.AutoBreeder; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.electric.AutoBreeder;
@ -175,7 +174,6 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.OreWasher;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.PressureChamber; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.PressureChamber;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.Smeltery; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.Smeltery;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.TableSaw; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.TableSaw;
import me.mrCookieSlime.Slimefun.Objects.handlers.BlockPlaceHandler;
import me.mrCookieSlime.Slimefun.Objects.handlers.ItemUseHandler; import me.mrCookieSlime.Slimefun.Objects.handlers.ItemUseHandler;
import me.mrCookieSlime.Slimefun.Objects.handlers.MultiBlockInteractionHandler; import me.mrCookieSlime.Slimefun.Objects.handlers.MultiBlockInteractionHandler;
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager; import me.mrCookieSlime.Slimefun.Setup.SlimefunManager;
@ -1298,30 +1296,9 @@ public final class SlimefunItemSetup {
new ItemStack[] {null, null, null, null, new ItemStack(Material.SPAWNER), null, null, null, null}) new ItemStack[] {null, null, null, null, new ItemStack(Material.SPAWNER), null, null, null, null})
.register(true); .register(true);
new SlimefunItem(Categories.MAGIC, (SlimefunItemStack) SlimefunItems.REPAIRED_SPAWNER, RecipeType.ANCIENT_ALTAR, new RepairedSpawner(Categories.MAGIC, (SlimefunItemStack) SlimefunItems.REPAIRED_SPAWNER, RecipeType.ANCIENT_ALTAR,
new ItemStack[] {SlimefunItems.RUNE_ENDER, SlimefunItems.FILLED_FLASK_OF_KNOWLEDGE, SlimefunItems.ESSENCE_OF_AFTERLIFE, SlimefunItems.FILLED_FLASK_OF_KNOWLEDGE, SlimefunItems.BROKEN_SPAWNER, SlimefunItems.FILLED_FLASK_OF_KNOWLEDGE, SlimefunItems.ESSENCE_OF_AFTERLIFE, SlimefunItems.FILLED_FLASK_OF_KNOWLEDGE, SlimefunItems.RUNE_ENDER}) new ItemStack[] {SlimefunItems.RUNE_ENDER, SlimefunItems.FILLED_FLASK_OF_KNOWLEDGE, SlimefunItems.ESSENCE_OF_AFTERLIFE, SlimefunItems.FILLED_FLASK_OF_KNOWLEDGE, SlimefunItems.BROKEN_SPAWNER, SlimefunItems.FILLED_FLASK_OF_KNOWLEDGE, SlimefunItems.ESSENCE_OF_AFTERLIFE, SlimefunItems.FILLED_FLASK_OF_KNOWLEDGE, SlimefunItems.RUNE_ENDER})
.register(true, (BlockPlaceHandler) (e, item) -> { .register(true);
if (SlimefunManager.isItemSimilar(item, SlimefunItems.REPAIRED_SPAWNER, false)) {
EntityType type = null;
for (String line: item.getItemMeta().getLore()) {
if (ChatColor.stripColor(line).startsWith("Type: ") && !line.contains("<Type>")) {
type = EntityType.valueOf(ChatColor.stripColor(line).replace("Type: ", "").replace(' ', '_').toUpperCase());
}
}
if (type != null) {
CreatureSpawner spawner = (CreatureSpawner) e.getBlock().getState();
spawner.setSpawnedType(type);
spawner.update(true, false);
}
return true;
}
else {
return false;
}
});
new EnhancedFurnace(1, 1, 1, (SlimefunItemStack) SlimefunItems.ENHANCED_FURNACE, new EnhancedFurnace(1, 1, 1, (SlimefunItemStack) SlimefunItems.ENHANCED_FURNACE,
new ItemStack[] {null, SlimefunItems.STEEL_INGOT, null, SlimefunItems.BASIC_CIRCUIT_BOARD, new ItemStack(Material.FURNACE), SlimefunItems.HEATING_COIL, null, SlimefunItems.ELECTRIC_MOTOR, null}) new ItemStack[] {null, SlimefunItems.STEEL_INGOT, null, SlimefunItems.BASIC_CIRCUIT_BOARD, new ItemStack(Material.FURNACE), SlimefunItems.HEATING_COIL, null, SlimefunItems.ELECTRIC_MOTOR, null})

View File

@ -9,10 +9,10 @@ import org.bukkit.Material;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.MultiBlock; import me.mrCookieSlime.Slimefun.Objects.MultiBlock;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
public class SlimefunMachine extends SlimefunItem implements RecipeDisplayItem { public class SlimefunMachine extends SlimefunItem implements RecipeDisplayItem {

View File

@ -19,6 +19,7 @@ import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem; import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.math.DoubleHandler; import io.github.thebusybiscuit.cscorelib2.math.DoubleHandler;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction; import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils; import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import io.github.thebusybiscuit.slimefun4.utils.NumberUtils; import io.github.thebusybiscuit.slimefun4.utils.NumberUtils;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config; import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
@ -29,7 +30,6 @@ import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems; import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager; import me.mrCookieSlime.Slimefun.Setup.SlimefunManager;
import me.mrCookieSlime.Slimefun.api.BlockStorage; import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
@ -246,8 +246,8 @@ public abstract class AGenerator extends SlimefunItem implements RecipeDisplayIt
} }
@Override @Override
public String getRecipeSectionLabel() { public String getLabelLocalPath() {
return "&7\u21E9 Available Types of Fuel \u21E9"; return "guide.tooltips.recipes.generator";
} }
@Override @Override

View File

@ -21,6 +21,7 @@ import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.math.DoubleHandler; import io.github.thebusybiscuit.cscorelib2.math.DoubleHandler;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction; import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import io.github.thebusybiscuit.cscorelib2.skull.SkullItem; import io.github.thebusybiscuit.cscorelib2.skull.SkullItem;
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils; import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import io.github.thebusybiscuit.slimefun4.utils.holograms.ReactorHologram; import io.github.thebusybiscuit.slimefun4.utils.holograms.ReactorHologram;
import io.github.thebusybiscuit.slimefun4.utils.holograms.SimpleHologram; import io.github.thebusybiscuit.slimefun4.utils.holograms.SimpleHologram;
@ -30,8 +31,7 @@ import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems; import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.RecipeDisplayItem; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.blocks.ReactorAccessPort;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.ReactorAccessPort;
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager; import me.mrCookieSlime.Slimefun.Setup.SlimefunManager;
import me.mrCookieSlime.Slimefun.api.BlockStorage; import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.Slimefun; import me.mrCookieSlime.Slimefun.api.Slimefun;
@ -407,8 +407,8 @@ public abstract class AReactor extends SlimefunItem implements RecipeDisplayItem
} }
@Override @Override
public String getRecipeSectionLabel() { public String getLabelLocalPath() {
return "&7\u21E9 Available Types of Fuel \u21E9"; return "guide.tooltips.recipes.generator";
} }
@Override @Override

View File

@ -1,4 +1,4 @@
package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines; package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.blocks;
import org.bukkit.entity.Item; import org.bukkit.entity.Item;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;

View File

@ -1,4 +1,4 @@
package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines; package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.blocks;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -48,11 +48,6 @@ public class HologramProjector extends SimpleSlimefunItem<BlockUseHandler> {
}); });
} }
@Override
protected boolean areItemHandlersPrivate() {
return false;
}
@Override @Override
public BlockUseHandler getItemHandler() { public BlockUseHandler getItemHandler() {
return e -> { return e -> {
@ -68,7 +63,7 @@ public class HologramProjector extends SimpleSlimefunItem<BlockUseHandler> {
} }
private void openEditor(Player p, Block projector) { private void openEditor(Player p, Block projector) {
ChestMenu menu = new ChestMenu("Hologram Settings"); ChestMenu menu = new ChestMenu(SlimefunPlugin.getLocal().getMessage(p, "machines.HOLOGRAM_PROJECTOR.inventory-title"));
menu.addItem(0, new CustomItem(Material.NAME_TAG, "&7Text &e(Click to edit)", "", "&r" + ChatColors.color(BlockStorage.getLocationInfo(projector.getLocation(), "text")))); menu.addItem(0, new CustomItem(Material.NAME_TAG, "&7Text &e(Click to edit)", "", "&r" + ChatColors.color(BlockStorage.getLocationInfo(projector.getLocation(), "text"))));
menu.addMenuClickHandler(0, (pl, slot, item, action) -> { menu.addMenuClickHandler(0, (pl, slot, item, action) -> {

View File

@ -1,4 +1,4 @@
package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines; package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.blocks;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -24,11 +24,6 @@ public class InfusedHopper extends SimpleSlimefunItem<BlockTicker> {
super(category, item, recipeType, recipe); super(category, item, recipeType, recipe);
} }
@Override
protected boolean areItemHandlersPrivate() {
return false;
}
@Override @Override
public BlockTicker getItemHandler() { public BlockTicker getItemHandler() {
return new BlockTicker() { return new BlockTicker() {

View File

@ -1,4 +1,4 @@
package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines; package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.blocks;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;

View File

@ -0,0 +1,55 @@
package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.blocks;
import java.util.Locale;
import org.bukkit.ChatColor;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SimpleSlimefunItem;
import me.mrCookieSlime.Slimefun.Objects.handlers.BlockPlaceHandler;
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
public class RepairedSpawner extends SimpleSlimefunItem<BlockPlaceHandler> {
public RepairedSpawner(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
}
@Override
protected boolean areItemHandlersPrivate() {
return false;
}
@Override
public BlockPlaceHandler getItemHandler() {
return (e, item) -> {
if (SlimefunManager.isItemSimilar(item, SlimefunItems.REPAIRED_SPAWNER, false)) {
EntityType type = null;
for (String line : item.getItemMeta().getLore()) {
if (ChatColor.stripColor(line).startsWith("Type: ") && !line.contains("<Type>")) {
type = EntityType.valueOf(ChatColor.stripColor(line).replace("Type: ", "").replace(' ', '_').toUpperCase(Locale.ROOT));
}
}
if (type != null) {
CreatureSpawner spawner = (CreatureSpawner) e.getBlock().getState();
spawner.setSpawnedType(type);
spawner.update(true, false);
}
return true;
}
else {
return false;
}
};
}
}

View File

@ -1,4 +1,4 @@
package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines; package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.blocks;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;

View File

@ -13,7 +13,7 @@ public interface DamageableItem {
boolean isDamageable(); boolean isDamageable();
default void damageItem(Player p, ItemStack item) { default void damageItem(Player p, ItemStack item) {
if (item != null && item.getType() != Material.AIR && item.getAmount() > 0 && isDamageable()) { if (isDamageable() && item != null && item.getType() != Material.AIR && item.getAmount() > 0) {
if (item.getEnchantments().containsKey(Enchantment.DURABILITY) && Math.random() * 100 <= (60 + Math.floorDiv(40, (item.getEnchantmentLevel(Enchantment.DURABILITY) + 1)))) { if (item.getEnchantments().containsKey(Enchantment.DURABILITY) && Math.random() * 100 <= (60 + Math.floorDiv(40, (item.getEnchantmentLevel(Enchantment.DURABILITY) + 1)))) {
return; return;
} }

View File

@ -1,21 +0,0 @@
package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces;
import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@FunctionalInterface
public interface RecipeDisplayItem {
List<ItemStack> getDisplayRecipes();
@Deprecated
default String getRecipeSectionLabel() {
return "&7\u21E9 Recipes made in this Machine \u21E9";
}
default String getRecipeSectionLabel(Player p) {
return getRecipeSectionLabel();
}
}

View File

@ -11,12 +11,12 @@ import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.collections.RandomizedSet; import io.github.thebusybiscuit.cscorelib2.collections.RandomizedSet;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction; import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin; import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems; import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SimpleSlimefunItem; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SimpleSlimefunItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.Objects.handlers.ItemUseHandler; import me.mrCookieSlime.Slimefun.Objects.handlers.ItemUseHandler;
import me.mrCookieSlime.Slimefun.api.Slimefun; import me.mrCookieSlime.Slimefun.api.Slimefun;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
@ -55,6 +55,11 @@ public class GoldPan extends SimpleSlimefunItem<ItemUseHandler> implements Recip
weights += chance; weights += chance;
} }
@Override
public String getLabelLocalPath() {
return "guide.tooltips.recipes.gold-pan";
}
@Override @Override
public ItemUseHandler getItemHandler() { public ItemUseHandler getItemHandler() {
return e -> { return e -> {

View File

@ -11,11 +11,11 @@ import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.collections.RandomizedSet; import io.github.thebusybiscuit.cscorelib2.collections.RandomizedSet;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction; import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin; import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SimpleSlimefunItem; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SimpleSlimefunItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.Objects.handlers.ItemUseHandler; import me.mrCookieSlime.Slimefun.Objects.handlers.ItemUseHandler;
import me.mrCookieSlime.Slimefun.api.Slimefun; import me.mrCookieSlime.Slimefun.api.Slimefun;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
@ -61,6 +61,11 @@ public class NetherGoldPan extends SimpleSlimefunItem<ItemUseHandler> implements
weights += chance; weights += chance;
} }
@Override
public String getLabelLocalPath() {
return "guide.tooltips.recipes.gold-pan";
}
@Override @Override
public ItemUseHandler getItemHandler() { public ItemUseHandler getItemHandler() {
return e -> { return e -> {

View File

@ -14,11 +14,11 @@ import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.materials.MaterialCollections; import io.github.thebusybiscuit.cscorelib2.materials.MaterialCollections;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction; import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin; import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SimpleSlimefunItem; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SimpleSlimefunItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.Objects.handlers.BlockUseHandler; import me.mrCookieSlime.Slimefun.Objects.handlers.BlockUseHandler;
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager; import me.mrCookieSlime.Slimefun.Setup.SlimefunManager;
import me.mrCookieSlime.Slimefun.api.Slimefun; import me.mrCookieSlime.Slimefun.api.Slimefun;

View File

@ -16,11 +16,11 @@ import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.materials.MaterialCollections; import io.github.thebusybiscuit.cscorelib2.materials.MaterialCollections;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction; import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin; import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SimpleSlimefunItem; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SimpleSlimefunItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.Objects.handlers.BlockUseHandler; import me.mrCookieSlime.Slimefun.Objects.handlers.BlockUseHandler;
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager; import me.mrCookieSlime.Slimefun.Setup.SlimefunManager;
import me.mrCookieSlime.Slimefun.api.BlockStorage; import me.mrCookieSlime.Slimefun.api.BlockStorage;

View File

@ -9,13 +9,13 @@ import org.bukkit.block.Block;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem; import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils; import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems; import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager; import me.mrCookieSlime.Slimefun.Setup.SlimefunManager;
import me.mrCookieSlime.Slimefun.api.BlockStorage; import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;

View File

@ -4,11 +4,11 @@ import org.bukkit.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem; import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems; import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
public abstract class CarbonPress extends AContainer implements RecipeDisplayItem { public abstract class CarbonPress extends AContainer implements RecipeDisplayItem {

View File

@ -9,13 +9,13 @@ import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.collections.RandomizedSet; import io.github.thebusybiscuit.cscorelib2.collections.RandomizedSet;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem; import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils; import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems; import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager; import me.mrCookieSlime.Slimefun.Setup.SlimefunManager;
import me.mrCookieSlime.Slimefun.api.BlockStorage; import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.Slimefun; import me.mrCookieSlime.Slimefun.api.Slimefun;

View File

@ -3,12 +3,12 @@ package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.electric;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems; import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
public abstract class ElectricIngotFactory extends AContainer implements RecipeDisplayItem { public abstract class ElectricIngotFactory extends AContainer implements RecipeDisplayItem {

View File

@ -6,12 +6,12 @@ import java.util.List;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems; import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
public class ElectricIngotPulverizer extends AContainer implements RecipeDisplayItem { public class ElectricIngotPulverizer extends AContainer implements RecipeDisplayItem {

View File

@ -3,10 +3,10 @@ package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.electric;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
public abstract class ElectricOreGrinder extends AContainer implements RecipeDisplayItem { public abstract class ElectricOreGrinder extends AContainer implements RecipeDisplayItem {

View File

@ -4,12 +4,12 @@ import org.bukkit.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem; import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems; import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
public abstract class ElectricPress extends AContainer implements RecipeDisplayItem { public abstract class ElectricPress extends AContainer implements RecipeDisplayItem {

View File

@ -3,11 +3,11 @@ package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.electric;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems; import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
public abstract class FoodComposter extends AContainer implements RecipeDisplayItem { public abstract class FoodComposter extends AContainer implements RecipeDisplayItem {

View File

@ -6,12 +6,12 @@ import java.util.List;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems; import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
public abstract class Freezer extends AContainer implements RecipeDisplayItem { public abstract class Freezer extends AContainer implements RecipeDisplayItem {

View File

@ -8,13 +8,13 @@ import org.bukkit.block.Block;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem; import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils; import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems; import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager; import me.mrCookieSlime.Slimefun.Setup.SlimefunManager;
import me.mrCookieSlime.Slimefun.api.BlockStorage; import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;

View File

@ -12,6 +12,7 @@ import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem; import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.slimefun4.api.geo.GEOResource; import io.github.thebusybiscuit.slimefun4.api.geo.GEOResource;
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils; import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import io.github.thebusybiscuit.slimefun4.utils.holograms.SimpleHologram; import io.github.thebusybiscuit.slimefun4.utils.holograms.SimpleHologram;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler; import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
@ -25,7 +26,6 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.UnregisterReason;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.InventoryBlock; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.InventoryBlock;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.api.BlockStorage; import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import me.mrCookieSlime.Slimefun.api.energy.ChargableBlock; import me.mrCookieSlime.Slimefun.api.energy.ChargableBlock;
@ -121,8 +121,8 @@ public abstract class GEOMiner extends AContainer implements InventoryBlock, Rec
} }
@Override @Override
public String getRecipeSectionLabel() { public String getLabelLocalPath() {
return "&7\u21E9 Resources you can obtain \u21E9"; return "guide.tooltips.recipes.miner";
} }
@Override @Override

View File

@ -13,6 +13,7 @@ import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem; import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction; import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import io.github.thebusybiscuit.slimefun4.api.geo.GEOResource; import io.github.thebusybiscuit.slimefun4.api.geo.GEOResource;
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils; import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import me.mrCookieSlime.Slimefun.SlimefunPlugin; import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Lists.RecipeType;
@ -20,7 +21,6 @@ import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.Category; import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager; import me.mrCookieSlime.Slimefun.Setup.SlimefunManager;
import me.mrCookieSlime.Slimefun.api.BlockStorage; import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;

View File

@ -27,6 +27,9 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
public final class SlimefunManager { public final class SlimefunManager {
private static final String EMERALDENCHANTS_LORE = ChatColor.YELLOW.toString() + ChatColor.YELLOW.toString() + ChatColor.GRAY.toString();
private static final String SOULBOUND_LORE = ChatColor.GRAY + "Soulbound";
private SlimefunManager() {} private SlimefunManager() {}
public static void registerArmorSet(ItemStack baseComponent, ItemStack[] items, String idSyntax, PotionEffect[][] effects, boolean special, boolean slimefun) { public static void registerArmorSet(ItemStack baseComponent, ItemStack[] items, String idSyntax, PotionEffect[][] effects, boolean special, boolean slimefun) {
@ -167,16 +170,14 @@ public final class SlimefunManager {
StringBuilder string1 = new StringBuilder(); StringBuilder string1 = new StringBuilder();
StringBuilder string2 = new StringBuilder(); StringBuilder string2 = new StringBuilder();
String colors = ChatColor.YELLOW.toString() + ChatColor.YELLOW.toString() + ChatColor.GRAY.toString();
for (String string : lore) { for (String string : lore) {
if (!string.equals(ChatColor.GRAY + "Soulbound") && !string.startsWith(colors)) { if (!string.equals(SOULBOUND_LORE) && !string.startsWith(EMERALDENCHANTS_LORE)) {
string1.append("-NEW LINE-").append(string); string1.append("-NEW LINE-").append(string);
} }
} }
for (String string : lore2) { for (String string : lore2) {
if (!string.equals(ChatColor.GRAY + "Soulbound") && !string.startsWith(colors)) { if (!string.equals(SOULBOUND_LORE) && !string.startsWith(EMERALDENCHANTS_LORE)) {
string2.append("-NEW LINE-").append(string); string2.append("-NEW LINE-").append(string);
} }
} }
@ -207,7 +208,7 @@ public final class SlimefunManager {
} }
else if (item.hasItemMeta()) { else if (item.hasItemMeta()) {
ItemMeta im = item.getItemMeta(); ItemMeta im = item.getItemMeta();
return (im.hasLore() && im.getLore().contains(ChatColor.GRAY + "Soulbound")); return (im.hasLore() && im.getLore().equals(SOULBOUND_LORE));
} }
return false; return false;

View File

@ -53,7 +53,9 @@ public final class Pedestals {
if (input.size() != 8) return null; if (input.size() != 8) return null;
if (SlimefunManager.isItemSimilar(catalyst, SlimefunItems.BROKEN_SPAWNER, false)) { if (SlimefunManager.isItemSimilar(catalyst, SlimefunItems.BROKEN_SPAWNER, false)) {
if (checkRecipe(SlimefunItems.BROKEN_SPAWNER, input) == null) return null; if (checkRecipe(SlimefunItems.BROKEN_SPAWNER, input) == null) {
return null;
}
ItemStack spawner = SlimefunItems.REPAIRED_SPAWNER.clone(); ItemStack spawner = SlimefunItems.REPAIRED_SPAWNER.clone();
ItemMeta im = spawner.getItemMeta(); ItemMeta im = spawner.getItemMeta();

View File

@ -22,9 +22,9 @@ import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.config.Config; import io.github.thebusybiscuit.cscorelib2.config.Config;
import io.github.thebusybiscuit.slimefun4.api.items.HashedArmorpiece; import io.github.thebusybiscuit.slimefun4.api.items.HashedArmorpiece;
import io.github.thebusybiscuit.slimefun4.api.player.PlayerBackpack;
import me.mrCookieSlime.Slimefun.SlimefunPlugin; import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Objects.Research; import me.mrCookieSlime.Slimefun.Objects.Research;
import me.mrCookieSlime.Slimefun.api.inventory.BackpackInventory;
/** /**
* A class that can store a Player's Research Profile for caching * A class that can store a Player's Research Profile for caching
@ -42,7 +42,7 @@ public final class PlayerProfile {
private boolean markedForDeletion = false; private boolean markedForDeletion = false;
private final Set<Research> researches = new HashSet<>(); private final Set<Research> researches = new HashSet<>();
private final Map<Integer, BackpackInventory> backpacks = new HashMap<>(); private final Map<Integer, PlayerBackpack> backpacks = new HashMap<>();
private final LinkedList<Object> guideHistory = new LinkedList<>(); private final LinkedList<Object> guideHistory = new LinkedList<>();
private final HashedArmorpiece[] armor = { private final HashedArmorpiece[] armor = {
@ -102,7 +102,7 @@ public final class PlayerProfile {
* This method will save the Player's Researches and Backpacks to the hard drive * This method will save the Player's Researches and Backpacks to the hard drive
*/ */
public void save() { public void save() {
for (BackpackInventory backpack : backpacks.values()) { for (PlayerBackpack backpack : backpacks.values()) {
backpack.save(); backpack.save();
} }
@ -164,22 +164,22 @@ public final class PlayerProfile {
this.dirty = true; this.dirty = true;
} }
public BackpackInventory createBackpack(int size) { public PlayerBackpack createBackpack(int size) {
IntStream stream = IntStream.iterate(0, i -> i + 1).filter(i -> !cfg.contains("backpacks." + i + ".size")); IntStream stream = IntStream.iterate(0, i -> i + 1).filter(i -> !cfg.contains("backpacks." + i + ".size"));
int id = stream.findFirst().getAsInt(); int id = stream.findFirst().getAsInt();
BackpackInventory backpack = new BackpackInventory(this, id, size); PlayerBackpack backpack = new PlayerBackpack(this, id, size);
backpacks.put(id, backpack); backpacks.put(id, backpack);
return backpack; return backpack;
} }
public BackpackInventory getBackpack(int id) { public PlayerBackpack getBackpack(int id) {
BackpackInventory backpack = backpacks.get(id); PlayerBackpack backpack = backpacks.get(id);
if (backpack != null) return backpack; if (backpack != null) return backpack;
else { else {
backpack = new BackpackInventory(this, id); backpack = new PlayerBackpack(this, id);
backpacks.put(id, backpack); backpacks.put(id, backpack);
return backpack; return backpack;
} }
@ -313,7 +313,7 @@ public final class PlayerProfile {
return SlimefunPlugin.getRegistry().getPlayerProfiles().values().iterator(); return SlimefunPlugin.getRegistry().getPlayerProfiles().values().iterator();
} }
public static BackpackInventory getBackpack(ItemStack item) { public static PlayerBackpack getBackpack(ItemStack item) {
if (item == null || !item.hasItemMeta() || !item.getItemMeta().hasLore()) return null; if (item == null || !item.hasItemMeta() || !item.getItemMeta().hasLore()) return null;
Optional<Integer> id = Optional.empty(); Optional<Integer> id = Optional.empty();

View File

@ -27,9 +27,9 @@ import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.math.DoubleHandler; import io.github.thebusybiscuit.cscorelib2.math.DoubleHandler;
import io.github.thebusybiscuit.slimefun4.api.network.Network; import io.github.thebusybiscuit.slimefun4.api.network.Network;
import io.github.thebusybiscuit.slimefun4.api.network.NetworkComponent; import io.github.thebusybiscuit.slimefun4.api.network.NetworkComponent;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import io.github.thebusybiscuit.slimefun4.utils.holograms.SimpleHologram; import io.github.thebusybiscuit.slimefun4.utils.holograms.SimpleHologram;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config; import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.MenuClickHandler;
import me.mrCookieSlime.Slimefun.SlimefunPlugin; import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager; import me.mrCookieSlime.Slimefun.Setup.SlimefunManager;
import me.mrCookieSlime.Slimefun.api.BlockStorage; import me.mrCookieSlime.Slimefun.api.BlockStorage;
@ -44,14 +44,13 @@ public class CargoNet extends Network {
private static final int RANGE = 5; private static final int RANGE = 5;
private static final int[] slots = new int[] {19, 20, 21, 28, 29, 30, 37, 38, 39}; private static final int[] slots = {19, 20, 21, 28, 29, 30, 37, 38, 39};
// Chest Terminal Stuff // Chest Terminal Stuff
public static final int[] terminal_slots = new int[] {0, 1, 2, 3, 4, 5, 6, 9, 10, 11, 12, 13, 14, 15, 18, 19, 20, 21, 22, 23, 24, 27, 28, 29, 30, 31, 32, 33, 36, 37, 38, 39, 40, 41, 42}; public static final int[] terminal_slots = {0, 1, 2, 3, 4, 5, 6, 9, 10, 11, 12, 13, 14, 15, 18, 19, 20, 21, 22, 23, 24, 27, 28, 29, 30, 31, 32, 33, 36, 37, 38, 39, 40, 41, 42};
public static final int TERMINAL_OUT_SLOT = 17; public static final int TERMINAL_OUT_SLOT = 17;
private static final ItemStack terminal_noitem_item = new CustomItem(new ItemStack(Material.BARRIER), "&4No Item cached"); private static final ItemStack terminal_noitem_item = new CustomItem(new ItemStack(Material.BARRIER), "&4No Item cached");
private static final MenuClickHandler terminal_noitem_handler = (p, slot, item, action) -> false;
private Set<Location> inputNodes = new HashSet<>(); private Set<Location> inputNodes = new HashSet<>();
private Set<Location> outputNodes = new HashSet<>(); private Set<Location> outputNodes = new HashSet<>();
@ -214,7 +213,7 @@ public class CargoNet extends Network {
if (menu.getItemInSlot(17) == null) { if (menu.getItemInSlot(17) == null) {
Block target = getAttachedBlock(bus.getBlock()); Block target = getAttachedBlock(bus.getBlock());
ItemSlot stack = CargoManager.withdraw(bus.getBlock(), target, -1); ItemAndInt stack = CargoUtils.withdraw(bus.getBlock(), target, -1);
if (stack != null) { if (stack != null) {
menu.replaceExistingItem(17, stack.getItem()); menu.replaceExistingItem(17, stack.getItem());
@ -232,7 +231,7 @@ public class CargoNet extends Network {
if (menu.getItemInSlot(17) != null) { if (menu.getItemInSlot(17) != null) {
Block target = getAttachedBlock(bus.getBlock()); Block target = getAttachedBlock(bus.getBlock());
menu.replaceExistingItem(17, CargoManager.insert(bus.getBlock(), target, menu.getItemInSlot(17), -1)); menu.replaceExistingItem(17, CargoUtils.insert(bus.getBlock(), target, menu.getItemInSlot(17), -1));
} }
if (menu.getItemInSlot(17) == null) { if (menu.getItemInSlot(17) == null) {
@ -276,7 +275,7 @@ public class CargoNet extends Network {
for (Location l : destinations) { for (Location l : destinations) {
Block target = getAttachedBlock(l.getBlock()); Block target = getAttachedBlock(l.getBlock());
requestedItem = CargoManager.insert(l.getBlock(), target, requestedItem, -1); requestedItem = CargoUtils.insert(l.getBlock(), target, requestedItem, -1);
if (requestedItem == null) { if (requestedItem == null) {
menu.replaceExistingItem(request.getSlot(), null); menu.replaceExistingItem(request.getSlot(), null);
@ -304,7 +303,7 @@ public class CargoNet extends Network {
for (Location l : providers) { for (Location l : providers) {
Block target = getAttachedBlock(l.getBlock()); Block target = getAttachedBlock(l.getBlock());
ItemStack is = CargoManager.withdraw(l.getBlock(), target, requested); ItemStack is = CargoUtils.withdraw(l.getBlock(), target, requested);
if (is != null) { if (is != null) {
if (stack == null) { if (stack == null) {
@ -355,11 +354,11 @@ public class CargoNet extends Network {
boolean roundrobin = "true".equals(cfg.getString("round-robin")); boolean roundrobin = "true".equals(cfg.getString("round-robin"));
if (inputTarget != null) { if (inputTarget != null) {
ItemSlot slot = CargoManager.withdraw(input.getBlock(), inputTarget, Integer.parseInt(cfg.getString("index"))); ItemAndInt slot = CargoUtils.withdraw(input.getBlock(), inputTarget, Integer.parseInt(cfg.getString("index")));
if (slot != null) { if (slot != null) {
stack = slot.getItem(); stack = slot.getItem();
previousSlot = slot.getSlot(); previousSlot = slot.getInt();
} }
} }
@ -389,7 +388,7 @@ public class CargoNet extends Network {
Block target = getAttachedBlock(out.getBlock()); Block target = getAttachedBlock(out.getBlock());
if (target != null) { if (target != null) {
stack = CargoManager.insert(out.getBlock(), target, stack, -1); stack = CargoUtils.insert(out.getBlock(), target, stack, -1);
if (stack == null) break; if (stack == null) break;
} }
} }
@ -397,7 +396,7 @@ public class CargoNet extends Network {
} }
if (stack != null && previousSlot > -1) { if (stack != null && previousSlot > -1) {
DirtyChestMenu menu = CargoManager.getChestMenu(inputTarget); DirtyChestMenu menu = CargoUtils.getChestMenu(inputTarget);
if (menu != null) { if (menu != null) {
menu.replaceExistingItem(previousSlot, stack); menu.replaceExistingItem(previousSlot, stack);
@ -414,7 +413,7 @@ public class CargoNet extends Network {
//Chest Terminal Code //Chest Terminal Code
if (extraChannels) { if (extraChannels) {
List<StoredItem> items = new ArrayList<>(); List<ItemAndInt> items = new ArrayList<>();
for (Location l : providers) { for (Location l : providers) {
Block target = getAttachedBlock(l.getBlock()); Block target = getAttachedBlock(l.getBlock());
@ -436,10 +435,10 @@ public class CargoNet extends Network {
for (int slot : blockMenu.getPreset().getSlotsAccessedByItemTransport((DirtyChestMenu) blockMenu, ItemTransportFlow.WITHDRAW, null)) { for (int slot : blockMenu.getPreset().getSlotsAccessedByItemTransport((DirtyChestMenu) blockMenu, ItemTransportFlow.WITHDRAW, null)) {
ItemStack is = blockMenu.getItemInSlot(slot); ItemStack is = blockMenu.getItemInSlot(slot);
if (is != null && CargoManager.matchesFilter(l.getBlock(), is, -1)) { if (is != null && CargoUtils.matchesFilter(l.getBlock(), is, -1)) {
boolean add = true; boolean add = true;
for (StoredItem item : items) { for (ItemAndInt item : items) {
if (SlimefunManager.isItemSimilar(is, item.getItem(), true)) { if (SlimefunManager.isItemSimilar(is, item.getItem(), true)) {
add = false; add = false;
item.add(is.getAmount() + stored); item.add(is.getAmount() + stored);
@ -447,7 +446,7 @@ public class CargoNet extends Network {
} }
if (add) { if (add) {
items.add(new StoredItem(new CustomItem(is, 1), is.getAmount() + stored)); items.add(new ItemAndInt(new CustomItem(is, 1), is.getAmount() + stored));
} }
} }
} }
@ -469,7 +468,7 @@ public class CargoNet extends Network {
} }
} }
Collections.sort(items, Comparator.comparingInt(item -> -item.getAmount())); Collections.sort(items, Comparator.comparingInt(item -> -item.getInt()));
for (Location l : terminals) { for (Location l : terminals) {
BlockMenu menu = BlockStorage.getInventory(l); BlockMenu menu = BlockStorage.getInventory(l);
@ -484,15 +483,15 @@ public class CargoNet extends Network {
int slot = terminal_slots[i]; int slot = terminal_slots[i];
if (items.size() > i + (terminal_slots.length * (page - 1))) { if (items.size() > i + (terminal_slots.length * (page - 1))) {
StoredItem item = items.get(i + (terminal_slots.length * (page - 1))); ItemAndInt item = items.get(i + (terminal_slots.length * (page - 1)));
ItemStack stack = item.getItem().clone(); ItemStack stack = item.getItem().clone();
ItemMeta im = stack.getItemMeta(); ItemMeta im = stack.getItemMeta();
List<String> lore = new ArrayList<>(); List<String> lore = new ArrayList<>();
lore.add(""); lore.add("");
lore.add(ChatColors.color("&7Stored Items: &r" + DoubleHandler.getFancyDouble(item.getAmount()))); lore.add(ChatColors.color("&7Stored Items: &r" + DoubleHandler.getFancyDouble(item.getInt())));
if (stack.getMaxStackSize() > 1) lore.add(ChatColors.color("&7<Left Click: Request 1 | Right Click: Request " + (item.getAmount() > stack.getMaxStackSize() ? stack.getMaxStackSize(): item.getAmount()) + ">")); if (stack.getMaxStackSize() > 1) lore.add(ChatColors.color("&7<Left Click: Request 1 | Right Click: Request " + (item.getInt() > stack.getMaxStackSize() ? stack.getMaxStackSize(): item.getInt()) + ">"));
else lore.add(ChatColors.color("&7<Left Click: Request 1>")); else lore.add(ChatColors.color("&7<Left Click: Request 1>"));
lore.add(""); lore.add("");
@ -504,7 +503,7 @@ public class CargoNet extends Network {
stack.setItemMeta(im); stack.setItemMeta(im);
menu.replaceExistingItem(slot, stack); menu.replaceExistingItem(slot, stack);
menu.addMenuClickHandler(slot, (p, sl, is, action) -> { menu.addMenuClickHandler(slot, (p, sl, is, action) -> {
int amount = item.getAmount() > item.getItem().getMaxStackSize() ? item.getItem().getMaxStackSize() : item.getAmount(); int amount = item.getInt() > item.getItem().getMaxStackSize() ? item.getItem().getMaxStackSize() : item.getInt();
itemRequests.add(new ItemRequest(l, 44, new CustomItem(item.getItem(), action.isRightClicked() ? amount : 1), ItemTransportFlow.WITHDRAW)); itemRequests.add(new ItemRequest(l, 44, new CustomItem(item.getItem(), action.isRightClicked() ? amount : 1), ItemTransportFlow.WITHDRAW));
return false; return false;
}); });
@ -512,7 +511,7 @@ public class CargoNet extends Network {
} }
else { else {
menu.replaceExistingItem(slot, terminal_noitem_item); menu.replaceExistingItem(slot, terminal_noitem_item);
menu.addMenuClickHandler(slot, terminal_noitem_handler); menu.addMenuClickHandler(slot, ChestMenuUtils.getEmptyClickHandler());
} }
} }
} }
@ -540,17 +539,17 @@ public class CargoNet extends Network {
return freq; return freq;
} }
private void handleWithdraw(DirtyChestMenu menu, List<StoredItem> items, Location l) { private void handleWithdraw(DirtyChestMenu menu, List<ItemAndInt> items, Location l) {
for (int slot : menu.getPreset().getSlotsAccessedByItemTransport(menu, ItemTransportFlow.WITHDRAW, null)) { for (int slot : menu.getPreset().getSlotsAccessedByItemTransport(menu, ItemTransportFlow.WITHDRAW, null)) {
filter(menu.getItemInSlot(slot), items, l); filter(menu.getItemInSlot(slot), items, l);
} }
} }
private void filter(ItemStack is, List<StoredItem> items, Location l) { private void filter(ItemStack is, List<ItemAndInt> items, Location l) {
if (is != null && CargoManager.matchesFilter(l.getBlock(), is, -1)) { if (is != null && CargoUtils.matchesFilter(l.getBlock(), is, -1)) {
boolean add = true; boolean add = true;
for (StoredItem item : items) { for (ItemAndInt item : items) {
if (SlimefunManager.isItemSimilar(is, item.getItem(), true)) { if (SlimefunManager.isItemSimilar(is, item.getItem(), true)) {
add = false; add = false;
item.add(is.getAmount()); item.add(is.getAmount());
@ -558,7 +557,7 @@ public class CargoNet extends Network {
} }
if (add) { if (add) {
items.add(new StoredItem(new CustomItem(is, 1), is.getAmount())); items.add(new ItemAndInt(new CustomItem(is, 1), is.getAmount()));
} }
} }
} }

View File

@ -19,13 +19,12 @@ import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu; import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
import me.mrCookieSlime.Slimefun.api.inventory.DirtyChestMenu; import me.mrCookieSlime.Slimefun.api.inventory.DirtyChestMenu;
public final class CargoManager { public final class CargoUtils {
//Whitelist or blacklist slots //Whitelist or blacklist slots
private static final int[] SLOTS = new int[]{19, 20, 21, 28, 29, 30, 37, 38, 39}; private static final int[] SLOTS = {19, 20, 21, 28, 29, 30, 37, 38, 39};
private CargoManager() { private CargoUtils() {}
}
public static ItemStack withdraw(Block node, Block target, ItemStack template) { public static ItemStack withdraw(Block node, Block target, ItemStack template) {
DirtyChestMenu menu = getChestMenu(target); DirtyChestMenu menu = getChestMenu(target);
@ -50,7 +49,14 @@ public final class CargoManager {
BlockState state = target.getState(); BlockState state = target.getState();
if (state instanceof InventoryHolder) { if (state instanceof InventoryHolder) {
Inventory inv = ((InventoryHolder) state).getInventory(); return withdrawFromVanillaInventory(node, template, ((InventoryHolder) state).getInventory());
}
}
return null;
}
private static ItemStack withdrawFromVanillaInventory(Block node, ItemStack template, Inventory inv) {
int minSlot = 0; int minSlot = 0;
int maxSlot = inv.getContents().length; int maxSlot = inv.getContents().length;
@ -61,6 +67,7 @@ public final class CargoManager {
else if (inv instanceof BrewerInventory) { else if (inv instanceof BrewerInventory) {
maxSlot = 3; maxSlot = 3;
} }
for (int slot = minSlot; slot < maxSlot; slot++) { for (int slot = minSlot; slot < maxSlot; slot++) {
ItemStack is = inv.getContents()[slot]; ItemStack is = inv.getContents()[slot];
@ -75,12 +82,11 @@ public final class CargoManager {
} }
} }
} }
}
}
return null; return null;
} }
public static ItemSlot withdraw(Block node, Block target, int index) { public static ItemAndInt withdraw(Block node, Block target, int index) {
DirtyChestMenu menu = getChestMenu(target); DirtyChestMenu menu = getChestMenu(target);
if (menu != null) { if (menu != null) {
@ -89,7 +95,7 @@ public final class CargoManager {
if (matchesFilter(node, is, index)) { if (matchesFilter(node, is, index)) {
menu.replaceExistingItem(slot, null); menu.replaceExistingItem(slot, null);
return new ItemSlot(is.clone(), slot); return new ItemAndInt(is.clone(), slot);
} }
} }
} }
@ -115,7 +121,7 @@ public final class CargoManager {
if (matchesFilter(node, is, index)) { if (matchesFilter(node, is, index)) {
inv.setItem(slot, null); inv.setItem(slot, null);
return new ItemSlot(is.clone(), slot); return new ItemAndInt(is.clone(), slot);
} }
} }
} }
@ -157,8 +163,14 @@ public final class CargoManager {
BlockState state = target.getState(); BlockState state = target.getState();
if (state instanceof InventoryHolder) { if (state instanceof InventoryHolder) {
Inventory inv = ((InventoryHolder) state).getInventory(); return insertIntoVanillaInventory(stack, ((InventoryHolder) state).getInventory());
}
}
return stack;
}
private static ItemStack insertIntoVanillaInventory(ItemStack stack, Inventory inv) {
int minSlot = 0; int minSlot = 0;
int maxSlot = inv.getContents().length; int maxSlot = inv.getContents().length;
@ -213,8 +225,6 @@ public final class CargoManager {
return stack; return stack;
} }
} }
}
}
return stack; return stack;
} }

View File

@ -1,25 +0,0 @@
package me.mrCookieSlime.Slimefun.api.item_transport;
public class ChannelIndex {
private final int channel;
private int index;
public ChannelIndex(int channel, int index) {
this.channel = channel;
this.index = index;
}
public void setIndex(int index) {
this.index = index;
}
public int getChannel() {
return this.channel;
}
public int getIndex() {
return this.index;
}
}

View File

@ -1,12 +0,0 @@
package me.mrCookieSlime.Slimefun.api.item_transport;
import java.util.Comparator;
public class ChestTerminalSorter implements Comparator<StoredItem> {
@Override
public int compare(StoredItem item1, StoredItem item2) {
return item2.getAmount() - item1.getAmount();
}
}

View File

@ -2,26 +2,26 @@ package me.mrCookieSlime.Slimefun.api.item_transport;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public class StoredItem { public class ItemAndInt {
private final ItemStack item; private final ItemStack item;
private int amount; private int number;
public StoredItem(ItemStack item, int amount) { public ItemAndInt(ItemStack item, int amount) {
this.amount = amount; this.number = amount;
this.item = item; this.item = item;
} }
public int getAmount() { public int getInt() {
return this.amount; return number;
} }
public ItemStack getItem() { public ItemStack getItem() {
return this.item; return item;
} }
public void add(int amount) { public void add(int amount) {
this.amount = this.amount + amount; number += amount;
} }
} }

View File

@ -1,23 +0,0 @@
package me.mrCookieSlime.Slimefun.api.item_transport;
import org.bukkit.inventory.ItemStack;
public class ItemSlot {
private final int slot;
private final ItemStack item;
public ItemSlot(ItemStack item, int slot) {
this.slot = slot;
this.item = item;
}
public int getSlot() {
return this.slot;
}
public ItemStack getItem() {
return this.item;
}
}

View File

@ -1,28 +0,0 @@
package me.mrCookieSlime.Slimefun.utils;
@Deprecated
public enum MachineTier {
BASIC("&eBasic"),
AVERAGE("&6Average"),
MEDIUM("&aMedium"),
GOOD("&2Good"),
ADVANCED("&6Advanced"),
END_GAME("&4End-Game");
private final String prefix;
private MachineTier(String prefix) {
this.prefix = prefix;
}
@Override
public String toString() {
return prefix;
}
public String and(MachineType type) {
return this + " " + type;
}
}

View File

@ -1,21 +0,0 @@
package me.mrCookieSlime.Slimefun.utils;
@Deprecated
public enum MachineType {
CAPACITOR("Capacitor"),
GENERATOR("Generator"),
MACHINE("Machine");
private final String suffix;
private MachineType(String suffix) {
this.suffix = suffix;
}
@Override
public String toString() {
return suffix;
}
}

View File

@ -26,6 +26,13 @@ guide:
tooltips: tooltips:
open-category: 'Click to open' open-category: 'Click to open'
versions-notice: 'These are very important when reporting bugs!' versions-notice: 'These are very important when reporting bugs!'
wiki: 'View this Item on the official Slimefun Wiki'
recipes:
machine: 'Recipes made in this Machine'
miner: 'Resources you can obtain with this Miner'
generator: 'Available types of fuel'
gold-pan: 'Resources you can obtain'
cheat: cheat:
no-multiblocks: '&4You cannot cheat in Multiblocks, you have to build them!' no-multiblocks: '&4You cannot cheat in Multiblocks, you have to build them!'
@ -154,6 +161,7 @@ machines:
HOLOGRAM_PROJECTOR: HOLOGRAM_PROJECTOR:
enter-text: '&7Please enter your desired Hologram Text into your Chat. &r(Color Codes are supported!)' enter-text: '&7Please enter your desired Hologram Text into your Chat. &r(Color Codes are supported!)'
inventory-title: 'Hologram Editor'
ELEVATOR: ELEVATOR:
no-destinations: '&4No destinations found' no-destinations: '&4No destinations found'
@ -169,6 +177,11 @@ machines:
cancelled: '&4Teleportation cancelled!' cancelled: '&4Teleportation cancelled!'
invulnerability: '&b&lYou have been given 30 seconds of Invulnerability!' invulnerability: '&b&lYou have been given 30 seconds of Invulnerability!'
GPS_CONTROL_PANEL:
title: 'GPS - Control Panel'
transmitters: 'Transmitter Overview'
waypoints: 'Waypoint Overview'
CARGO_NODES: CARGO_NODES:
must-be-placed: '&4Must be placed onto a chest or machine!' must-be-placed: '&4Must be placed onto a chest or machine!'
@ -206,8 +219,10 @@ inventory:
android: android:
started: '&7Your Android resumed running its script' started: '&7Your Android resumed running its script'
stopped: '&7Your Android has paused its script' stopped: '&7Your Android has paused its script'
scripts: scripts:
already-uploaded: '&4This script has already been uploaded.' already-uploaded: '&4This script has already been uploaded.'
editor: 'Script Editor'
instructions: instructions:
START: '&2Start Script' START: '&2Start Script'
@ -280,3 +295,7 @@ languages:
uk: 'Ukrainian' uk: 'Ukrainian'
ms: 'Malay' ms: 'Malay'
'no': 'Norwegian' 'no': 'Norwegian'
ja: 'Japanese'
fa: 'Persian'
th: 'Thai'
ro: 'Romanian'