mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Improved Slimefun Guide History, it now remembers category pages
This commit is contained in:
parent
afac5cc0ce
commit
84dbea4473
@ -54,6 +54,7 @@
|
|||||||
* Added "Snow blocks to Ice" recipe to the Freezer
|
* Added "Snow blocks to Ice" recipe to the Freezer
|
||||||
* You can now use Cooked Salmon in an Auto Drier to craft Fish Jerky
|
* You can now use Cooked Salmon in an Auto Drier to craft Fish Jerky
|
||||||
* The Lumber Axe can now strip logs too
|
* The Lumber Axe can now strip logs too
|
||||||
|
* The Slimefun Guide can now remember what page of a Category or Minecraft Item you were on
|
||||||
|
|
||||||
#### Changes
|
#### Changes
|
||||||
* Removed some deprecated parts of the API
|
* Removed some deprecated parts of the API
|
||||||
@ -75,6 +76,8 @@
|
|||||||
* Fixed #1711
|
* Fixed #1711
|
||||||
* Fixed Slimefun Guide showing shaped recipes incorrectly
|
* Fixed Slimefun Guide showing shaped recipes incorrectly
|
||||||
* Fixed #1719
|
* Fixed #1719
|
||||||
|
* Fixed death waypoints not having the correct texture
|
||||||
|
* Fixed Androids having no texture when moving
|
||||||
|
|
||||||
## Release Candidate 9 (07 Mar 2020)
|
## Release Candidate 9 (07 Mar 2020)
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ public class ErrorReport {
|
|||||||
Slimefun.getLogger().log(Level.WARNING, "");
|
Slimefun.getLogger().log(Level.WARNING, "");
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException x) {
|
catch (FileNotFoundException x) {
|
||||||
Slimefun.getLogger().log(Level.SEVERE, "An Error occured while saving an Error-Report for Slimefun " + SlimefunPlugin.getVersion(), x);
|
Slimefun.getLogger().log(Level.SEVERE, x, () -> "An Error occured while saving an Error-Report for Slimefun " + SlimefunPlugin.getVersion());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ public class GPSNetwork {
|
|||||||
public ItemStack getIcon(Map.Entry<String, Location> entry) {
|
public ItemStack getIcon(Map.Entry<String, Location> entry) {
|
||||||
Location l = entry.getValue();
|
Location l = entry.getValue();
|
||||||
|
|
||||||
if (entry.getKey().startsWith("&4Deathpoint")) {
|
if (entry.getKey().startsWith("player:death ")) {
|
||||||
return deathpointIcon;
|
return deathpointIcon;
|
||||||
}
|
}
|
||||||
else if (l.getWorld().getEnvironment() == Environment.NETHER) {
|
else if (l.getWorld().getEnvironment() == Environment.NETHER) {
|
||||||
@ -164,7 +164,7 @@ public class GPSNetwork {
|
|||||||
Location l = entry.getValue();
|
Location l = entry.getValue();
|
||||||
ItemStack globe = getIcon(entry);
|
ItemStack globe = getIcon(entry);
|
||||||
|
|
||||||
menu.addItem(slot, new CustomItem(globe, entry.getKey(), "&8\u21E8 &7World: &r" + l.getWorld().getName(), "&8\u21E8 &7X: &r" + l.getX(), "&8\u21E8 &7Y: &r" + l.getY(), "&8\u21E8 &7Z: &r" + l.getZ(), "", "&8\u21E8 &cClick to delete"));
|
menu.addItem(slot, new CustomItem(globe, entry.getKey().replace("player:death ", ""), "&8\u21E8 &7World: &r" + l.getWorld().getName(), "&8\u21E8 &7X: &r" + l.getX(), "&8\u21E8 &7Y: &r" + l.getY(), "&8\u21E8 &7Z: &r" + l.getZ(), "", "&8\u21E8 &cClick to delete"));
|
||||||
menu.addMenuClickHandler(slot, (pl, slotn, item, action) -> {
|
menu.addMenuClickHandler(slot, (pl, slotn, item, action) -> {
|
||||||
String id = ChatColor.stripColor(ChatColor.translateAlternateColorCodes('&', entry.getKey())).toUpperCase().replace(' ', '_');
|
String id = ChatColor.stripColor(ChatColor.translateAlternateColorCodes('&', entry.getKey())).toUpperCase().replace(' ', '_');
|
||||||
Config cfg = new Config(WAYPOINTS_DIRECTORY + pl.getUniqueId().toString() + ".yml");
|
Config cfg = new Config(WAYPOINTS_DIRECTORY + pl.getUniqueId().toString() + ".yml");
|
||||||
|
@ -65,7 +65,7 @@ public final class TeleportationManager {
|
|||||||
Location l = entry.getValue();
|
Location l = entry.getValue();
|
||||||
ItemStack globe = network.getIcon(entry);
|
ItemStack globe = network.getIcon(entry);
|
||||||
|
|
||||||
menu.addItem(slot, new CustomItem(globe, entry.getKey(), "", "&8\u21E8 &7" + SlimefunPlugin.getLocal().getResourceString(p, "tooltips.world") + ": &r" + l.getWorld().getName(), "&8\u21E8 &7X: &r" + l.getX(), "&8\u21E8 &7Y: &r" + l.getY(), "&8\u21E8 &7Z: &r" + l.getZ(), "&8\u21E8 &7" + SlimefunPlugin.getLocal().getMessage(p, "machines.TELEPORTER.gui.time") + ": &r" + DoubleHandler.fixDouble(0.5 * getTeleportationTime(complexity, source, l)) + "s", "", "&8\u21E8 &c" + SlimefunPlugin.getLocal().getMessage(p, "machines.TELEPORTER.gui.tooltip")));
|
menu.addItem(slot, new CustomItem(globe, entry.getKey().replace("player:death ", ""), "", "&8\u21E8 &7" + SlimefunPlugin.getLocal().getResourceString(p, "tooltips.world") + ": &r" + l.getWorld().getName(), "&8\u21E8 &7X: &r" + l.getX(), "&8\u21E8 &7Y: &r" + l.getY(), "&8\u21E8 &7Z: &r" + l.getZ(), "&8\u21E8 &7" + SlimefunPlugin.getLocal().getMessage(p, "machines.TELEPORTER.gui.time") + ": &r" + DoubleHandler.fixDouble(0.5 * getTeleportationTime(complexity, source, l)) + "s", "", "&8\u21E8 &c" + SlimefunPlugin.getLocal().getMessage(p, "machines.TELEPORTER.gui.tooltip")));
|
||||||
menu.addMenuClickHandler(slot, (pl, s, item, action) -> {
|
menu.addMenuClickHandler(slot, (pl, s, item, action) -> {
|
||||||
pl.closeInventory();
|
pl.closeInventory();
|
||||||
teleport(pl.getUniqueId(), complexity, source, l, false);
|
teleport(pl.getUniqueId(), complexity, source, l, false);
|
||||||
|
@ -21,7 +21,6 @@ import io.github.thebusybiscuit.slimefun4.implementation.listeners.NetworkListen
|
|||||||
public final class NetworkManager {
|
public final class NetworkManager {
|
||||||
|
|
||||||
private final int maxNodes;
|
private final int maxNodes;
|
||||||
private boolean isChestTerminalInstalled = false;
|
|
||||||
private final List<Network> networks = new LinkedList<>();
|
private final List<Network> networks = new LinkedList<>();
|
||||||
|
|
||||||
public NetworkManager(int capacity) {
|
public NetworkManager(int capacity) {
|
||||||
@ -32,14 +31,6 @@ public final class NetworkManager {
|
|||||||
return maxNodes;
|
return maxNodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isChestTerminalInstalled() {
|
|
||||||
return isChestTerminalInstalled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setChestTerminalInstalled(boolean installed) {
|
|
||||||
isChestTerminalInstalled = installed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Network> getNetworkList() {
|
public List<Network> getNetworkList() {
|
||||||
return networks;
|
return networks;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.listeners.BackpackListe
|
|||||||
* be opened.
|
* be opened.
|
||||||
*
|
*
|
||||||
* It holds an actual {@link Inventory} and represents the backpack on the
|
* It holds an actual {@link Inventory} and represents the backpack on the
|
||||||
* level of an individual{@link ItemStack} as opposed to the class {@link SlimefunBackpack}.
|
* level of an individual {@link ItemStack} as opposed to the class {@link SlimefunBackpack}.
|
||||||
*
|
*
|
||||||
* @author TheBusyBiscuit
|
* @author TheBusyBiscuit
|
||||||
*
|
*
|
||||||
|
@ -4,7 +4,6 @@ import java.io.File;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@ -22,6 +21,7 @@ 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.core.guide.GuideHistory;
|
||||||
import io.github.thebusybiscuit.slimefun4.utils.PatternUtils;
|
import io.github.thebusybiscuit.slimefun4.utils.PatternUtils;
|
||||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||||
import me.mrCookieSlime.Slimefun.Objects.Research;
|
import me.mrCookieSlime.Slimefun.Objects.Research;
|
||||||
@ -47,7 +47,7 @@ public final class PlayerProfile {
|
|||||||
|
|
||||||
private final Set<Research> researches = new HashSet<>();
|
private final Set<Research> researches = new HashSet<>();
|
||||||
private final Map<Integer, PlayerBackpack> backpacks = new HashMap<>();
|
private final Map<Integer, PlayerBackpack> backpacks = new HashMap<>();
|
||||||
private final LinkedList<Object> guideHistory = new LinkedList<>();
|
private final GuideHistory guideHistory = new GuideHistory(this);
|
||||||
|
|
||||||
private final HashedArmorpiece[] armor = { new HashedArmorpiece(), new HashedArmorpiece(), new HashedArmorpiece(), new HashedArmorpiece() };
|
private final HashedArmorpiece[] armor = { new HashedArmorpiece(), new HashedArmorpiece(), new HashedArmorpiece(), new HashedArmorpiece() };
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ public final class PlayerProfile {
|
|||||||
return Bukkit.getPlayer(getUUID());
|
return Bukkit.getPlayer(getUUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
public LinkedList<Object> getGuideHistory() {
|
public GuideHistory getGuideHistory() {
|
||||||
return guideHistory;
|
return guideHistory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ class GiveCommand extends SubCommand {
|
|||||||
|
|
||||||
SlimefunItem sfItem = SlimefunItem.getByID(args[2].toUpperCase());
|
SlimefunItem sfItem = SlimefunItem.getByID(args[2].toUpperCase());
|
||||||
if (sfItem != null) {
|
if (sfItem != null) {
|
||||||
int amount = parseAmount(sender, args);
|
int amount = parseAmount(args);
|
||||||
|
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
SlimefunPlugin.getLocal().sendMessage(p, "messages.given-item", true, msg -> msg.replace(PLACEHOLDER_ITEM, sfItem.getItemName()).replace(PLACEHOLDER_AMOUNT, String.valueOf(amount)));
|
SlimefunPlugin.getLocal().sendMessage(p, "messages.given-item", true, msg -> msg.replace(PLACEHOLDER_ITEM, sfItem.getItemName()).replace(PLACEHOLDER_AMOUNT, String.valueOf(amount)));
|
||||||
@ -61,7 +61,7 @@ class GiveCommand extends SubCommand {
|
|||||||
else SlimefunPlugin.getLocal().sendMessage(sender, "messages.no-permission", true);
|
else SlimefunPlugin.getLocal().sendMessage(sender, "messages.no-permission", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int parseAmount(CommandSender sender, String[] args) {
|
private int parseAmount(String[] args) {
|
||||||
int amount = 1;
|
int amount = 1;
|
||||||
|
|
||||||
if (args.length == 4) {
|
if (args.length == 4) {
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
package io.github.thebusybiscuit.slimefun4.core.guide;
|
||||||
|
|
||||||
|
class GuideEntry<T> {
|
||||||
|
|
||||||
|
private final T object;
|
||||||
|
private int page;
|
||||||
|
|
||||||
|
GuideEntry(T object, int page) {
|
||||||
|
this.object = object;
|
||||||
|
this.page = page;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getIndexedObject() {
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPage() {
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPage(int page) {
|
||||||
|
this.page = page;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,111 @@
|
|||||||
|
package io.github.thebusybiscuit.slimefun4.core.guide;
|
||||||
|
|
||||||
|
import java.util.Deque;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||||
|
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||||
|
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link GuideHistory} represents the browsing history of a {@link Player} through the
|
||||||
|
* {@link SlimefunGuide}.
|
||||||
|
*
|
||||||
|
* @author TheBusyBiscuit
|
||||||
|
*
|
||||||
|
* @see SlimefunGuide
|
||||||
|
* @see PlayerProfile
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class GuideHistory {
|
||||||
|
|
||||||
|
private final PlayerProfile profile;
|
||||||
|
private final Deque<GuideEntry<?>> queue = new LinkedList<>();
|
||||||
|
|
||||||
|
public GuideHistory(PlayerProfile profile) {
|
||||||
|
this.profile = profile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
queue.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(Category category, int page) {
|
||||||
|
refresh(category, page);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(ItemStack item, int page) {
|
||||||
|
refresh(item, page);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(SlimefunItem item) {
|
||||||
|
queue.add(new GuideEntry<>(item, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(String searchTerm) {
|
||||||
|
queue.add(new GuideEntry<>(searchTerm, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
private <T> void refresh(T object, int page) {
|
||||||
|
GuideEntry<?> lastEntry = getLastEntry(false);
|
||||||
|
|
||||||
|
if (lastEntry != null && lastEntry.getIndexedObject() == object) {
|
||||||
|
lastEntry.setPage(page);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
queue.add(new GuideEntry<>(object, page));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int size() {
|
||||||
|
return queue.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the last page in the {@link SlimefunGuide} that was visited by a {@link Player}.
|
||||||
|
* Optionally also rewinds the history back to that entry.
|
||||||
|
*
|
||||||
|
* @param remove
|
||||||
|
* Whether to remove the current entry so it moves back to the entry returned.
|
||||||
|
* @return The last Guide Entry that was saved to the given Players guide history.
|
||||||
|
*/
|
||||||
|
private GuideEntry<?> getLastEntry(boolean remove) {
|
||||||
|
if (remove && !queue.isEmpty()) {
|
||||||
|
queue.removeLast();
|
||||||
|
}
|
||||||
|
|
||||||
|
return queue.isEmpty() ? null : queue.getLast();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void openLastEntry(SlimefunGuideImplementation guide, boolean survival) {
|
||||||
|
GuideEntry<?> entry = getLastEntry(false);
|
||||||
|
open(guide, entry, survival);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void goBack(SlimefunGuideImplementation guide, boolean survival) {
|
||||||
|
GuideEntry<?> entry = getLastEntry(true);
|
||||||
|
open(guide, entry, survival);
|
||||||
|
}
|
||||||
|
|
||||||
|
private <T> void open(SlimefunGuideImplementation guide, GuideEntry<T> entry, boolean survival) {
|
||||||
|
if (entry == null) {
|
||||||
|
guide.openMainMenu(profile, survival, 1);
|
||||||
|
}
|
||||||
|
else if (entry.getIndexedObject() instanceof Category) {
|
||||||
|
guide.openCategory(profile, (Category) entry.getIndexedObject(), survival, entry.getPage());
|
||||||
|
}
|
||||||
|
else if (entry.getIndexedObject() instanceof SlimefunItem) {
|
||||||
|
guide.displayItem(profile, (SlimefunItem) entry.getIndexedObject(), false);
|
||||||
|
}
|
||||||
|
else if (entry.getIndexedObject() instanceof String) {
|
||||||
|
guide.openSearch(profile, (String) entry.getIndexedObject(), survival, false);
|
||||||
|
}
|
||||||
|
else if (entry.getIndexedObject() instanceof ItemStack) {
|
||||||
|
guide.displayItem(profile, (ItemStack) entry.getIndexedObject(), entry.getPage(), false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -87,13 +87,12 @@ public final class SlimefunGuide {
|
|||||||
if (!SlimefunPlugin.getWhitelist().getBoolean(p.getWorld().getName() + ".enabled")) return;
|
if (!SlimefunPlugin.getWhitelist().getBoolean(p.getWorld().getName() + ".enabled")) return;
|
||||||
if (!SlimefunPlugin.getWhitelist().getBoolean(p.getWorld().getName() + ".enabled-items.SLIMEFUN_GUIDE")) return;
|
if (!SlimefunPlugin.getWhitelist().getBoolean(p.getWorld().getName() + ".enabled-items.SLIMEFUN_GUIDE")) return;
|
||||||
|
|
||||||
SlimefunGuideImplementation guide = SlimefunPlugin.getRegistry().getGuideLayout(layout);
|
Optional<PlayerProfile> optional = PlayerProfile.find(p);
|
||||||
Object last = null;
|
|
||||||
|
|
||||||
Optional<PlayerProfile> profile = PlayerProfile.find(p);
|
if (optional.isPresent()) {
|
||||||
if (profile.isPresent()) {
|
PlayerProfile profile = optional.get();
|
||||||
last = guide.getLastEntry(profile.get(), false);
|
SlimefunGuideImplementation guide = SlimefunPlugin.getRegistry().getGuideLayout(layout);
|
||||||
guide.openEntry(profile.get(), last, true);
|
profile.getGuideHistory().openLastEntry(guide, true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
openMainMenuAsync(p, true, layout, 1);
|
openMainMenuAsync(p, true, layout, 1);
|
||||||
@ -120,7 +119,7 @@ public final class SlimefunGuide {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void displayItem(PlayerProfile profile, ItemStack item, boolean addToHistory) {
|
public static void displayItem(PlayerProfile profile, ItemStack item, boolean addToHistory) {
|
||||||
SlimefunPlugin.getRegistry().getGuideLayout(SlimefunGuideLayout.CHEST).displayItem(profile, item, addToHistory);
|
SlimefunPlugin.getRegistry().getGuideLayout(SlimefunGuideLayout.CHEST).displayItem(profile, item, 0, addToHistory);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void displayItem(PlayerProfile profile, SlimefunItem item, boolean addToHistory) {
|
public static void displayItem(PlayerProfile profile, SlimefunItem item, boolean addToHistory) {
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
package io.github.thebusybiscuit.slimefun4.core.guide;
|
package io.github.thebusybiscuit.slimefun4.core.guide;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||||
@ -10,7 +7,6 @@ import io.github.thebusybiscuit.slimefun4.implementation.guide.BookSlimefunGuide
|
|||||||
import io.github.thebusybiscuit.slimefun4.implementation.guide.ChestSlimefunGuide;
|
import io.github.thebusybiscuit.slimefun4.implementation.guide.ChestSlimefunGuide;
|
||||||
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.api.GuideHandler;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface is used for the different implementations that add behaviour
|
* This interface is used for the different implementations that add behaviour
|
||||||
@ -48,46 +44,8 @@ public interface SlimefunGuideImplementation {
|
|||||||
|
|
||||||
void openSearch(PlayerProfile profile, String input, boolean survival, boolean addToHistory);
|
void openSearch(PlayerProfile profile, String input, boolean survival, boolean addToHistory);
|
||||||
|
|
||||||
void displayItem(PlayerProfile profile, ItemStack item, boolean addToHistory);
|
void displayItem(PlayerProfile profile, ItemStack item, int index, boolean addToHistory);
|
||||||
|
|
||||||
void displayItem(PlayerProfile profile, SlimefunItem item, boolean addToHistory);
|
void displayItem(PlayerProfile profile, SlimefunItem item, boolean addToHistory);
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves the last page in the {@link SlimefunGuide} that was visited by a {@link Player}.
|
|
||||||
* Optionally also rewinds the history back to that entry.
|
|
||||||
*
|
|
||||||
* @param profile
|
|
||||||
* The {@link PlayerProfile} of the {@link Player} you are querying
|
|
||||||
* @param remove
|
|
||||||
* Whether to remove the current entry so it moves back to the entry returned.
|
|
||||||
* @return The last Guide Entry that was saved to the given Players guide history.
|
|
||||||
*/
|
|
||||||
default Object getLastEntry(PlayerProfile profile, boolean remove) {
|
|
||||||
LinkedList<Object> history = profile.getGuideHistory();
|
|
||||||
|
|
||||||
if (remove && !history.isEmpty()) {
|
|
||||||
history.removeLast();
|
|
||||||
}
|
|
||||||
|
|
||||||
return history.isEmpty() ? null : history.getLast();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Opens the given Guide Entry to the {@link Player} of the specified {@link PlayerProfile}.
|
|
||||||
*
|
|
||||||
* @param profile
|
|
||||||
* The {@link PlayerProfile} of the {@link Player} we are opening this to
|
|
||||||
* @param entry
|
|
||||||
* The Guide Entry to open
|
|
||||||
* @param survival
|
|
||||||
* Whether this is the survival-version of the guide or cheat sheet version
|
|
||||||
*/
|
|
||||||
default void openEntry(PlayerProfile profile, Object entry, boolean survival) {
|
|
||||||
if (entry == null) openMainMenu(profile, survival, 1);
|
|
||||||
else if (entry instanceof Category) openCategory(profile, (Category) entry, survival, 1);
|
|
||||||
else if (entry instanceof SlimefunItem) displayItem(profile, (SlimefunItem) entry, false);
|
|
||||||
else if (entry instanceof GuideHandler) ((GuideHandler) entry).run(profile.getPlayer(), survival, getLayout() == SlimefunGuideLayout.BOOK);
|
|
||||||
else if (entry instanceof String) openSearch(profile, (String) entry, survival, false);
|
|
||||||
else displayItem(profile, (ItemStack) entry, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ public class BackupService implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException x) {
|
catch (IOException x) {
|
||||||
Slimefun.getLogger().log(Level.SEVERE, "An Error occured while creating a backup for Slimefun " + SlimefunPlugin.getVersion(), x);
|
Slimefun.getLogger().log(Level.SEVERE, x, () -> "An Error occured while creating a backup for Slimefun " + SlimefunPlugin.getVersion());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ public class LocalizationService extends SlimefunLocalization {
|
|||||||
getConfig().getConfiguration().setDefaults(config);
|
getConfig().getConfiguration().setDefaults(config);
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
Slimefun.getLogger().log(Level.SEVERE, "Failed to load language file: \"" + path + "\"", e);
|
Slimefun.getLogger().log(Level.SEVERE, e, () -> "Failed to load language file: \"" + path + "\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
save();
|
save();
|
||||||
@ -207,7 +207,7 @@ public class LocalizationService extends SlimefunLocalization {
|
|||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
Slimefun.getLogger().log(Level.SEVERE, "Failed to load language file into memory: \"" + path + "\"", e);
|
Slimefun.getLogger().log(Level.SEVERE, e, () -> "Failed to load language file into memory: \"" + path + "\"");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ abstract class GitHubConnector {
|
|||||||
onSuccess(element);
|
onSuccess(element);
|
||||||
}
|
}
|
||||||
catch (IOException x) {
|
catch (IOException x) {
|
||||||
Slimefun.getLogger().log(Level.SEVERE, "An Error occured while parsing GitHub-Data for Slimefun " + SlimefunPlugin.getVersion(), x);
|
Slimefun.getLogger().log(Level.SEVERE, x, () -> "An Error occured while parsing GitHub-Data for Slimefun " + SlimefunPlugin.getVersion());
|
||||||
onFailure();
|
onFailure();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ public class ThirdPartyPluginService {
|
|||||||
private final SlimefunPlugin plugin;
|
private final SlimefunPlugin plugin;
|
||||||
|
|
||||||
private boolean isExoticGardenInstalled = false;
|
private boolean isExoticGardenInstalled = false;
|
||||||
|
private boolean isChestTerminalInstalled = false;
|
||||||
private boolean isEmeraldEnchantsInstalled = false;
|
private boolean isEmeraldEnchantsInstalled = false;
|
||||||
private boolean isCoreProtectInstalled = false;
|
private boolean isCoreProtectInstalled = false;
|
||||||
private boolean isPlaceholderAPIInstalled = false;
|
private boolean isPlaceholderAPIInstalled = false;
|
||||||
@ -49,10 +50,9 @@ public class ThirdPartyPluginService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isExoticGardenInstalled = isPluginInstalled("ExoticGarden");
|
isExoticGardenInstalled = isPluginInstalled("ExoticGarden");
|
||||||
|
isChestTerminalInstalled = isPluginInstalled("ChestTerminal");
|
||||||
isEmeraldEnchantsInstalled = isPluginInstalled("EmeraldEnchants");
|
isEmeraldEnchantsInstalled = isPluginInstalled("EmeraldEnchants");
|
||||||
|
|
||||||
SlimefunPlugin.getNetworkManager().setChestTerminalInstalled(isPluginInstalled("ChestTerminal"));
|
|
||||||
|
|
||||||
// WorldEdit Hook to clear Slimefun Data upon //set 0 //cut or any other equivalent
|
// WorldEdit Hook to clear Slimefun Data upon //set 0 //cut or any other equivalent
|
||||||
if (isPluginInstalled("WorldEdit")) {
|
if (isPluginInstalled("WorldEdit")) {
|
||||||
try {
|
try {
|
||||||
@ -60,8 +60,10 @@ public class ThirdPartyPluginService {
|
|||||||
new WorldEditHook();
|
new WorldEditHook();
|
||||||
}
|
}
|
||||||
catch (Exception x) {
|
catch (Exception x) {
|
||||||
Slimefun.getLogger().log(Level.WARNING, "Failed to hook into WorldEdit!");
|
String version = plugin.getServer().getPluginManager().getPlugin("WorldEdit").getDescription().getVersion();
|
||||||
|
|
||||||
Slimefun.getLogger().log(Level.WARNING, "Maybe consider updating WorldEdit or Slimefun?");
|
Slimefun.getLogger().log(Level.WARNING, "Maybe consider updating WorldEdit or Slimefun?");
|
||||||
|
Slimefun.getLogger().log(Level.WARNING, "Failed to hook into WorldEdit v" + version, x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -81,6 +83,10 @@ public class ThirdPartyPluginService {
|
|||||||
return isExoticGardenInstalled;
|
return isExoticGardenInstalled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isChestTerminalInstalled() {
|
||||||
|
return isChestTerminalInstalled;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isEmeraldEnchantsInstalled() {
|
public boolean isEmeraldEnchantsInstalled() {
|
||||||
return isEmeraldEnchantsInstalled;
|
return isEmeraldEnchantsInstalled;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ class WorldEditHook {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void wrapForLogging(final EditSessionEvent event) {
|
public void wrapForLogging(EditSessionEvent event) {
|
||||||
event.setExtent(new AbstractDelegateExtent(event.getExtent()) {
|
event.setExtent(new AbstractDelegateExtent(event.getExtent()) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -37,6 +37,7 @@ class WorldEditHook {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return getExtent().setBlock(pos, block);
|
return getExtent().setBlock(pos, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ public class BookSlimefunGuide implements SlimefunGuideImplementation {
|
|||||||
if (category.getItems().size() < 250) {
|
if (category.getItems().size() < 250) {
|
||||||
|
|
||||||
if (survival) {
|
if (survival) {
|
||||||
profile.getGuideHistory().add(category);
|
profile.getGuideHistory().add(category, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<TellRawMessage> pages = new ArrayList<>();
|
List<TellRawMessage> pages = new ArrayList<>();
|
||||||
@ -293,7 +293,7 @@ public class BookSlimefunGuide implements SlimefunGuideImplementation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void displayItem(PlayerProfile profile, ItemStack item, boolean addToHistory) {
|
public void displayItem(PlayerProfile profile, ItemStack item, int index, boolean addToHistory) {
|
||||||
SlimefunGuide.displayItem(profile, item, addToHistory);
|
SlimefunGuide.displayItem(profile, item, addToHistory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ package io.github.thebusybiscuit.slimefun4.implementation.guide;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -26,6 +25,7 @@ import io.github.thebusybiscuit.cscorelib2.recipes.MinecraftRecipe;
|
|||||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||||
import io.github.thebusybiscuit.slimefun4.core.MultiBlock;
|
import io.github.thebusybiscuit.slimefun4.core.MultiBlock;
|
||||||
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
|
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
|
||||||
|
import io.github.thebusybiscuit.slimefun4.core.guide.GuideHistory;
|
||||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
|
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
|
||||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideImplementation;
|
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideImplementation;
|
||||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideLayout;
|
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideLayout;
|
||||||
@ -172,7 +172,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
|||||||
if (p == null) return;
|
if (p == null) return;
|
||||||
|
|
||||||
if (survival) {
|
if (survival) {
|
||||||
profile.getGuideHistory().add(category);
|
profile.getGuideHistory().add(category, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChestMenu menu = create(p);
|
ChestMenu menu = create(p);
|
||||||
@ -336,7 +336,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void displayItem(PlayerProfile profile, ItemStack item, boolean addToHistory) {
|
public void displayItem(PlayerProfile profile, ItemStack item, int index, boolean addToHistory) {
|
||||||
Player p = profile.getPlayer();
|
Player p = profile.getPlayer();
|
||||||
if (p == null) return;
|
if (p == null) return;
|
||||||
|
|
||||||
@ -359,7 +359,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
showMinecraftRecipe(recipes, 0, item, profile, p, addToHistory);
|
showMinecraftRecipe(recipes, index, item, profile, p, addToHistory);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showMinecraftRecipe(Recipe[] recipes, int index, ItemStack item, PlayerProfile profile, Player p, boolean addToHistory) {
|
private void showMinecraftRecipe(Recipe[] recipes, int index, ItemStack item, PlayerProfile profile, Player p, boolean addToHistory) {
|
||||||
@ -404,6 +404,11 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ChestMenu menu = create(p);
|
ChestMenu menu = create(p);
|
||||||
|
|
||||||
|
if (addToHistory) {
|
||||||
|
profile.getGuideHistory().add(item, index);
|
||||||
|
}
|
||||||
|
|
||||||
displayItem(menu, profile, p, item, result, recipeType, recipeItems, task, addToHistory);
|
displayItem(menu, profile, p, item, result, recipeType, recipeItems, task, addToHistory);
|
||||||
|
|
||||||
if (recipes.length > 1) {
|
if (recipes.length > 1) {
|
||||||
@ -413,14 +418,14 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
|||||||
|
|
||||||
menu.addItem(28, ChestMenuUtils.getPreviousButton(p, index + 1, recipes.length), (pl, slot, action, stack) -> {
|
menu.addItem(28, ChestMenuUtils.getPreviousButton(p, index + 1, recipes.length), (pl, slot, action, stack) -> {
|
||||||
if (index > 0) {
|
if (index > 0) {
|
||||||
showMinecraftRecipe(recipes, index - 1, item, profile, p, false);
|
showMinecraftRecipe(recipes, index - 1, item, profile, p, true);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
menu.addItem(34, ChestMenuUtils.getNextButton(p, index + 1, recipes.length), (pl, slot, action, stack) -> {
|
menu.addItem(34, ChestMenuUtils.getNextButton(p, index + 1, recipes.length), (pl, slot, action, stack) -> {
|
||||||
if (index < recipes.length - 1) {
|
if (index < recipes.length - 1) {
|
||||||
showMinecraftRecipe(recipes, index + 1, item, profile, p, false);
|
showMinecraftRecipe(recipes, index + 1, item, profile, p, true);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
@ -455,6 +460,10 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
|||||||
|
|
||||||
RecipeChoiceTask task = new RecipeChoiceTask();
|
RecipeChoiceTask task = new RecipeChoiceTask();
|
||||||
|
|
||||||
|
if (addToHistory) {
|
||||||
|
profile.getGuideHistory().add(item);
|
||||||
|
}
|
||||||
|
|
||||||
displayItem(menu, profile, p, item, result, recipeType, recipe, task, addToHistory);
|
displayItem(menu, profile, p, item, result, recipeType, recipe, task, addToHistory);
|
||||||
|
|
||||||
if (item instanceof RecipeDisplayItem) {
|
if (item instanceof RecipeDisplayItem) {
|
||||||
@ -468,18 +477,13 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayItem(ChestMenu menu, PlayerProfile profile, Player p, Object obj, ItemStack output, RecipeType recipeType, ItemStack[] recipe, RecipeChoiceTask task, boolean addToHistory) {
|
private void displayItem(ChestMenu menu, PlayerProfile profile, Player p, Object item, ItemStack output, RecipeType recipeType, ItemStack[] recipe, RecipeChoiceTask task, boolean addToHistory) {
|
||||||
LinkedList<Object> history = profile.getGuideHistory();
|
boolean isSlimefunRecipe = item instanceof SlimefunItem;
|
||||||
boolean isSlimefunRecipe = obj instanceof SlimefunItem;
|
|
||||||
|
|
||||||
if (addToHistory) {
|
|
||||||
history.add(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
addBackButton(menu, 0, p, profile, true);
|
addBackButton(menu, 0, p, profile, true);
|
||||||
|
|
||||||
MenuClickHandler clickHandler = (pl, slot, itemstack, action) -> {
|
MenuClickHandler clickHandler = (pl, slot, itemstack, action) -> {
|
||||||
displayItem(profile, itemstack, true);
|
displayItem(profile, itemstack, 0, true);
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -487,7 +491,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
|||||||
ItemStack recipeItem = getDisplayItem(p, isSlimefunRecipe, recipe[i]);
|
ItemStack recipeItem = getDisplayItem(p, isSlimefunRecipe, recipe[i]);
|
||||||
menu.addItem(recipeSlots[i], recipeItem, clickHandler);
|
menu.addItem(recipeSlots[i], recipeItem, clickHandler);
|
||||||
|
|
||||||
if (recipeItem != null && obj instanceof MultiBlockMachine) {
|
if (recipeItem != null && item instanceof MultiBlockMachine) {
|
||||||
for (Tag<Material> tag : MultiBlock.SUPPORTED_TAGS) {
|
for (Tag<Material> tag : MultiBlock.SUPPORTED_TAGS) {
|
||||||
if (tag.isTagged(recipeItem.getType())) {
|
if (tag.isTagged(recipeItem.getType())) {
|
||||||
task.add(recipeSlots[i], tag);
|
task.add(recipeSlots[i], tag);
|
||||||
@ -530,9 +534,9 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addBackButton(ChestMenu menu, int slot, Player p, PlayerProfile profile, boolean survival) {
|
private void addBackButton(ChestMenu menu, int slot, Player p, PlayerProfile profile, boolean survival) {
|
||||||
List<Object> playerHistory = profile.getGuideHistory();
|
GuideHistory history = profile.getGuideHistory();
|
||||||
|
|
||||||
if (survival && playerHistory.size() > 1) {
|
if (survival && history.size() > 1) {
|
||||||
menu.addItem(slot, new CustomItem(ChestMenuUtils.getBackButton(p, "", "&rLeft Click: &7Go back to previous Page", "&rShift + left Click: &7Go back to Main Menu")));
|
menu.addItem(slot, new CustomItem(ChestMenuUtils.getBackButton(p, "", "&rLeft Click: &7Go back to previous Page", "&rShift + left Click: &7Go back to Main Menu")));
|
||||||
|
|
||||||
menu.addMenuClickHandler(slot, (pl, s, is, action) -> {
|
menu.addMenuClickHandler(slot, (pl, s, is, action) -> {
|
||||||
@ -540,8 +544,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
|||||||
openMainMenu(profile, survival, 1);
|
openMainMenu(profile, survival, 1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Object last = getLastEntry(profile, true);
|
history.goBack(this, survival);
|
||||||
openEntry(profile, last, survival);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
@ -626,7 +629,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
|||||||
|
|
||||||
if (page == 0) {
|
if (page == 0) {
|
||||||
menu.addMenuClickHandler(slot, (pl, s, itemstack, action) -> {
|
menu.addMenuClickHandler(slot, (pl, s, itemstack, action) -> {
|
||||||
displayItem(profile, itemstack, true);
|
displayItem(profile, itemstack, 0, true);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ import org.bukkit.entity.Animals;
|
|||||||
import org.bukkit.entity.Monster;
|
import org.bukkit.entity.Monster;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
@ -59,7 +60,7 @@ public abstract class ProgrammableAndroid extends Android implements InventoryBl
|
|||||||
public ProgrammableAndroid(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
public ProgrammableAndroid(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||||
super(category, item, recipeType, recipe);
|
super(category, item, recipeType, recipe);
|
||||||
|
|
||||||
this.texture = item.getBase64Texture().orElse(null);
|
this.texture = item.getSkullTexture().orElse(null);
|
||||||
registerDefaultFuelTypes();
|
registerDefaultFuelTypes();
|
||||||
|
|
||||||
new BlockMenuPreset(getID(), "Programmable Android") {
|
new BlockMenuPreset(getID(), "Programmable Android") {
|
||||||
@ -399,12 +400,17 @@ public abstract class ProgrammableAndroid extends Android implements InventoryBl
|
|||||||
ItemStack item = d.getInventory().getItem(slot);
|
ItemStack item = d.getInventory().getItem(slot);
|
||||||
|
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
ItemStack currentFuel = menu.getItemInSlot(43);
|
insertFuel(menu, d.getInventory(), slot, menu.getItemInSlot(43), item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean insertFuel(BlockMenu menu, Inventory dispenser, int slot, ItemStack currentFuel, ItemStack newFuel) {
|
||||||
if (currentFuel == null) {
|
if (currentFuel == null) {
|
||||||
menu.replaceExistingItem(43, item);
|
menu.replaceExistingItem(43, item);
|
||||||
d.getInventory().setItem(slot, null);
|
dispenser.setItem(slot, null);
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
else if (SlimefunManager.isItemSimilar(item, currentFuel, true)) {
|
else if (SlimefunManager.isItemSimilar(item, currentFuel, true)) {
|
||||||
int rest = item.getType().getMaxStackSize() - currentFuel.getAmount();
|
int rest = item.getType().getMaxStackSize() - currentFuel.getAmount();
|
||||||
@ -414,11 +420,10 @@ public abstract class ProgrammableAndroid extends Android implements InventoryBl
|
|||||||
menu.replaceExistingItem(43, new CustomItem(item, currentFuel.getAmount() + amount));
|
menu.replaceExistingItem(43, new CustomItem(item, currentFuel.getAmount() + amount));
|
||||||
ItemUtils.consumeItem(item, amount, false);
|
ItemUtils.consumeItem(item, amount, false);
|
||||||
}
|
}
|
||||||
break;
|
return true;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void move(Block b, BlockFace face, Block block) {
|
protected void move(Block b, BlockFace face, Block block) {
|
||||||
|
@ -99,7 +99,7 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
|
|||||||
menu.addMenuClickHandler(41, (p, slot, item, action) -> {
|
menu.addMenuClickHandler(41, (p, slot, item, action) -> {
|
||||||
int channel = Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency")) - 1;
|
int channel = Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency")) - 1;
|
||||||
if (channel < 0) {
|
if (channel < 0) {
|
||||||
if (SlimefunPlugin.getNetworkManager().isChestTerminalInstalled()) channel = 16;
|
if (SlimefunPlugin.getThirdPartySupportService().isChestTerminalInstalled()) channel = 16;
|
||||||
else channel = 15;
|
else channel = 15;
|
||||||
}
|
}
|
||||||
BlockStorage.addBlockInfo(b, "frequency", String.valueOf(channel));
|
BlockStorage.addBlockInfo(b, "frequency", String.valueOf(channel));
|
||||||
@ -122,7 +122,7 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
|
|||||||
menu.addMenuClickHandler(43, (p, slot, item, action) -> {
|
menu.addMenuClickHandler(43, (p, slot, item, action) -> {
|
||||||
int channeln = Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency")) + 1;
|
int channeln = Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency")) + 1;
|
||||||
|
|
||||||
if (SlimefunPlugin.getNetworkManager().isChestTerminalInstalled()) {
|
if (SlimefunPlugin.getThirdPartySupportService().isChestTerminalInstalled()) {
|
||||||
if (channeln > 16) channeln = 0;
|
if (channeln > 16) channeln = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -117,7 +117,7 @@ public class CargoInputNode extends SlimefunItem {
|
|||||||
menu.addMenuClickHandler(41, (p, slot, item, action) -> {
|
menu.addMenuClickHandler(41, (p, slot, item, action) -> {
|
||||||
int channel = Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency")) - 1;
|
int channel = Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency")) - 1;
|
||||||
if (channel < 0) {
|
if (channel < 0) {
|
||||||
if (SlimefunPlugin.getNetworkManager().isChestTerminalInstalled()) channel = 16;
|
if (SlimefunPlugin.getThirdPartySupportService().isChestTerminalInstalled()) channel = 16;
|
||||||
else channel = 15;
|
else channel = 15;
|
||||||
}
|
}
|
||||||
BlockStorage.addBlockInfo(b, "frequency", String.valueOf(channel));
|
BlockStorage.addBlockInfo(b, "frequency", String.valueOf(channel));
|
||||||
@ -140,7 +140,7 @@ public class CargoInputNode extends SlimefunItem {
|
|||||||
menu.addMenuClickHandler(43, (p, slot, item, action) -> {
|
menu.addMenuClickHandler(43, (p, slot, item, action) -> {
|
||||||
int channeln = Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency")) + 1;
|
int channeln = Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency")) + 1;
|
||||||
|
|
||||||
if (SlimefunPlugin.getNetworkManager().isChestTerminalInstalled()) {
|
if (SlimefunPlugin.getThirdPartySupportService().isChestTerminalInstalled()) {
|
||||||
if (channeln > 16) channeln = 0;
|
if (channeln > 16) channeln = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -43,7 +43,7 @@ public class CargoOutputNode extends SlimefunItem {
|
|||||||
int channel = Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency")) - 1;
|
int channel = Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency")) - 1;
|
||||||
|
|
||||||
if (channel < 0) {
|
if (channel < 0) {
|
||||||
if (SlimefunPlugin.getNetworkManager().isChestTerminalInstalled()) channel = 16;
|
if (SlimefunPlugin.getThirdPartySupportService().isChestTerminalInstalled()) channel = 16;
|
||||||
else channel = 15;
|
else channel = 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ public class CargoOutputNode extends SlimefunItem {
|
|||||||
menu.addMenuClickHandler(14, (p, slot, item, action) -> {
|
menu.addMenuClickHandler(14, (p, slot, item, action) -> {
|
||||||
int channeln = Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency")) + 1;
|
int channeln = Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency")) + 1;
|
||||||
|
|
||||||
if (SlimefunPlugin.getNetworkManager().isChestTerminalInstalled()) {
|
if (SlimefunPlugin.getThirdPartySupportService().isChestTerminalInstalled()) {
|
||||||
if (channeln > 16) channeln = 0;
|
if (channeln > 16) channeln = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -83,7 +83,8 @@ public abstract class SolarGenerator extends SimpleSlimefunItem<GeneratorTicker>
|
|||||||
super.preRegister();
|
super.preRegister();
|
||||||
|
|
||||||
// This prevents Players from toggling the Daylight sensor
|
// This prevents Players from toggling the Daylight sensor
|
||||||
addItemHandler((BlockUseHandler) PlayerRightClickEvent::cancel);
|
BlockUseHandler handler = PlayerRightClickEvent::cancel;
|
||||||
|
addItemHandler(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -79,6 +79,14 @@ public abstract class ElectricDustWasher extends AContainer {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (int slot : getInputSlots()) {
|
for (int slot : getInputSlots()) {
|
||||||
|
if (process(b, menu, slot)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean process(Block b, BlockMenu menu, int slot) {
|
||||||
if (SlimefunManager.isItemSimilar(menu.getItemInSlot(slot), SlimefunItems.SIFTED_ORE, true)) {
|
if (SlimefunManager.isItemSimilar(menu.getItemInSlot(slot), SlimefunItems.SIFTED_ORE, true)) {
|
||||||
if (!legacyMode) {
|
if (!legacyMode) {
|
||||||
boolean emptySlot = false;
|
boolean emptySlot = false;
|
||||||
@ -89,27 +97,36 @@ public abstract class ElectricDustWasher extends AContainer {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!emptySlot) return;
|
|
||||||
|
if (!emptySlot) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack adding = oreWasher.getRandomDust();
|
ItemStack adding = oreWasher.getRandomDust();
|
||||||
MachineRecipe r = new MachineRecipe(4 / getSpeed(), new ItemStack[0], new ItemStack[] { adding });
|
MachineRecipe r = new MachineRecipe(4 / getSpeed(), new ItemStack[0], new ItemStack[] { adding });
|
||||||
if (legacyMode && !menu.fits(r.getOutput()[0], getOutputSlots())) return;
|
|
||||||
|
if (!legacyMode || menu.fits(r.getOutput()[0], getOutputSlots())) {
|
||||||
menu.consumeItem(slot);
|
menu.consumeItem(slot);
|
||||||
processing.put(b, r);
|
processing.put(b, r);
|
||||||
progress.put(b, r.getTicks());
|
progress.put(b, r.getTicks());
|
||||||
break;
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else if (SlimefunManager.isItemSimilar(menu.getItemInSlot(slot), SlimefunItems.PULVERIZED_ORE, true)) {
|
else if (SlimefunManager.isItemSimilar(menu.getItemInSlot(slot), SlimefunItems.PULVERIZED_ORE, true)) {
|
||||||
MachineRecipe r = new MachineRecipe(4 / getSpeed(), new ItemStack[0], new ItemStack[] { SlimefunItems.PURE_ORE_CLUSTER });
|
MachineRecipe r = new MachineRecipe(4 / getSpeed(), new ItemStack[0], new ItemStack[] { SlimefunItems.PURE_ORE_CLUSTER });
|
||||||
if (!menu.fits(r.getOutput()[0], getOutputSlots())) return;
|
|
||||||
|
if (menu.fits(r.getOutput()[0], getOutputSlots())) {
|
||||||
menu.consumeItem(slot);
|
menu.consumeItem(slot);
|
||||||
processing.put(b, r);
|
processing.put(b, r);
|
||||||
progress.put(b, r.getTicks());
|
progress.put(b, r.getTicks());
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -117,30 +117,42 @@ public abstract class ElectricGoldPan extends AContainer implements RecipeDispla
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (int slot : getInputSlots()) {
|
for (int slot : getInputSlots()) {
|
||||||
|
if (process(b, menu, slot)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean process(Block b, BlockMenu menu, int slot) {
|
||||||
if (SlimefunManager.isItemSimilar(menu.getItemInSlot(slot), new ItemStack(Material.GRAVEL), true)) {
|
if (SlimefunManager.isItemSimilar(menu.getItemInSlot(slot), new ItemStack(Material.GRAVEL), true)) {
|
||||||
ItemStack output = randomizer.getRandom();
|
ItemStack output = randomizer.getRandom();
|
||||||
|
|
||||||
MachineRecipe r = new MachineRecipe(3 / getSpeed(), new ItemStack[0], new ItemStack[] {output});
|
MachineRecipe r = new MachineRecipe(3 / getSpeed(), new ItemStack[0], new ItemStack[] {output});
|
||||||
if (!menu.fits(output, getOutputSlots())) return;
|
|
||||||
|
|
||||||
|
if (menu.fits(output, getOutputSlots())) {
|
||||||
menu.consumeItem(slot);
|
menu.consumeItem(slot);
|
||||||
processing.put(b, r);
|
processing.put(b, r);
|
||||||
progress.put(b, r.getTicks());
|
progress.put(b, r.getTicks());
|
||||||
break;
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else if (SlimefunManager.isItemSimilar(menu.getItemInSlot(slot), new ItemStack(Material.SOUL_SAND), true)) {
|
else if (SlimefunManager.isItemSimilar(menu.getItemInSlot(slot), new ItemStack(Material.SOUL_SAND), true)) {
|
||||||
ItemStack output = randomizerNether.getRandom();
|
ItemStack output = randomizerNether.getRandom();
|
||||||
|
|
||||||
MachineRecipe r = new MachineRecipe(4 / getSpeed(), new ItemStack[0], new ItemStack[] {output});
|
MachineRecipe r = new MachineRecipe(4 / getSpeed(), new ItemStack[0], new ItemStack[] {output});
|
||||||
if (!menu.fits(output, getOutputSlots())) return;
|
|
||||||
|
|
||||||
|
if (menu.fits(output, getOutputSlots())) {
|
||||||
menu.consumeItem(slot);
|
menu.consumeItem(slot);
|
||||||
processing.put(b, r);
|
processing.put(b, r);
|
||||||
progress.put(b, r.getTicks());
|
progress.put(b, r.getTicks());
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -58,7 +58,7 @@ public class Compressor extends MultiBlockMachine {
|
|||||||
removing.setAmount(recipeInput.getAmount());
|
removing.setAmount(recipeInput.getAmount());
|
||||||
inv.removeItem(removing);
|
inv.removeItem(removing);
|
||||||
|
|
||||||
craft(p, output, inv, outputInv);
|
craft(p, output, outputInv);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SlimefunPlugin.getLocal().sendMessage(p, "machines.full-inventory", true);
|
SlimefunPlugin.getLocal().sendMessage(p, "machines.full-inventory", true);
|
||||||
@ -72,7 +72,7 @@ public class Compressor extends MultiBlockMachine {
|
|||||||
SlimefunPlugin.getLocal().sendMessage(p, "machines.unknown-material", true);
|
SlimefunPlugin.getLocal().sendMessage(p, "machines.unknown-material", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void craft(Player p, ItemStack output, Inventory inv, Inventory outputInv) {
|
private void craft(Player p, ItemStack output, Inventory outputInv) {
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
int j = i;
|
int j = i;
|
||||||
|
|
||||||
|
@ -21,12 +21,12 @@ public class DeathpointListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onDamage(EntityDeathEvent e) {
|
public void onDeath(EntityDeathEvent e) {
|
||||||
if (e.getEntity().getType() == EntityType.PLAYER) {
|
if (e.getEntity().getType() == EntityType.PLAYER) {
|
||||||
Player p = (Player) e.getEntity();
|
Player p = (Player) e.getEntity();
|
||||||
|
|
||||||
if (p.getInventory().containsAtLeast(SlimefunItems.GPS_EMERGENCY_TRANSMITTER, 1)) {
|
if (p.getInventory().containsAtLeast(SlimefunItems.GPS_EMERGENCY_TRANSMITTER, 1)) {
|
||||||
SlimefunPlugin.getGPSNetwork().addWaypoint(p, SlimefunPlugin.getLocal().getMessage(p, "gps.deathpoint").replace("%date%", format.format(new Date())), p.getLocation().getBlock().getLocation());
|
SlimefunPlugin.getGPSNetwork().addWaypoint(p, "player:death " + SlimefunPlugin.getLocal().getMessage(p, "gps.deathpoint").replace("%date%", format.format(new Date())), p.getLocation().getBlock().getLocation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,10 +28,12 @@ public class DispenserListener implements Listener {
|
|||||||
SlimefunItem machine = BlockStorage.check(b);
|
SlimefunItem machine = BlockStorage.check(b);
|
||||||
|
|
||||||
if (machine != null) {
|
if (machine != null) {
|
||||||
|
machine.callItemHandler(BlockDispenseHandler.class, handler -> {
|
||||||
Dispenser dispenser = (Dispenser) b.getState();
|
Dispenser dispenser = (Dispenser) b.getState();
|
||||||
BlockFace face = ((Directional) b.getBlockData()).getFacing();
|
BlockFace face = ((Directional) b.getBlockData()).getFacing();
|
||||||
Block block = b.getRelative(face);
|
Block block = b.getRelative(face);
|
||||||
machine.callItemHandler(BlockDispenseHandler.class, handler -> handler.onBlockDispense(e, dispenser, block, machine));
|
handler.onBlockDispense(e, dispenser, block, machine);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public class EnhancedFurnaceListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onBurn(FurnaceBurnEvent e) {
|
public void onFuelBurn(FurnaceBurnEvent e) {
|
||||||
SlimefunItem furnace = BlockStorage.check(e.getBlock());
|
SlimefunItem furnace = BlockStorage.check(e.getBlock());
|
||||||
|
|
||||||
if (furnace instanceof EnhancedFurnace && ((EnhancedFurnace) furnace).getFuelEfficiency() > 0) {
|
if (furnace instanceof EnhancedFurnace && ((EnhancedFurnace) furnace).getFuelEfficiency() > 0) {
|
||||||
@ -41,7 +41,7 @@ public class EnhancedFurnaceListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onSmelt(FurnaceSmeltEvent e) {
|
public void onItemSmelt(FurnaceSmeltEvent e) {
|
||||||
SlimefunItem sfItem = BlockStorage.check(e.getBlock());
|
SlimefunItem sfItem = BlockStorage.check(e.getBlock());
|
||||||
|
|
||||||
if (sfItem instanceof EnhancedFurnace) {
|
if (sfItem instanceof EnhancedFurnace) {
|
||||||
|
@ -23,7 +23,7 @@ public class ItemPickupListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPickup(EntityPickupItemEvent e) {
|
public void onEntityPickup(EntityPickupItemEvent e) {
|
||||||
if (e.getItem().hasMetadata(METADATA_JEY)) {
|
if (e.getItem().hasMetadata(METADATA_JEY)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -34,7 +34,7 @@ public class ItemPickupListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onMinecartPickup(InventoryPickupItemEvent e) {
|
public void onHopperPickup(InventoryPickupItemEvent e) {
|
||||||
if (e.getItem().hasMetadata(METADATA_JEY)) {
|
if (e.getItem().hasMetadata(METADATA_JEY)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -164,12 +164,6 @@ public class TalismanListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param e
|
|
||||||
* BlockBreakEvent
|
|
||||||
* @since 4.2.0
|
|
||||||
*/
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onBlockBreak(BlockBreakEvent e) {
|
public void onBlockBreak(BlockBreakEvent e) {
|
||||||
ItemStack item = e.getPlayer().getInventory().getItemInMainHand();
|
ItemStack item = e.getPlayer().getInventory().getItemInMainHand();
|
||||||
|
@ -34,7 +34,7 @@ public class WorldListener implements Listener {
|
|||||||
storage.save(true);
|
storage.save(true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Slimefun.getLogger().log(Level.SEVERE, "Could not save Slimefun Blocks for World \"" + e.getWorld().getName() + "\"");
|
Slimefun.getLogger().log(Level.SEVERE, "Could not save Slimefun Blocks for World \"{0}\"", e.getWorld().getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,11 +116,12 @@ public class TickerTask implements Runnable {
|
|||||||
Integer chunk = chunkItemCount.get(tickedChunk);
|
Integer chunk = chunkItemCount.get(tickedChunk);
|
||||||
Integer machine = machineCount.get(item.getID());
|
Integer machine = machineCount.get(item.getID());
|
||||||
|
|
||||||
machineTimings.put(item.getID(), (machinetime != null ? machinetime: 0) + (System.nanoTime() - timestamp3));
|
machineTimings.put(item.getID(), (machinetime != null ? machinetime : 0) + (System.nanoTime() - timestamp3));
|
||||||
chunkItemCount.put(tickedChunk, (chunk != null ? chunk: 0) + 1);
|
chunkItemCount.put(tickedChunk, (chunk != null ? chunk : 0) + 1);
|
||||||
machineCount.put(item.getID(), (machine != null ? machine: 0) + 1);
|
machineCount.put(item.getID(), (machine != null ? machine : 0) + 1);
|
||||||
blockTimings.put(l, System.nanoTime() - timestamp3);
|
blockTimings.put(l, System.nanoTime() - timestamp3);
|
||||||
} catch (Exception x) {
|
}
|
||||||
|
catch (Exception x) {
|
||||||
int errors = bugged.getOrDefault(l, 0);
|
int errors = bugged.getOrDefault(l, 0);
|
||||||
reportErrors(l, item, x, errors);
|
reportErrors(l, item, x, errors);
|
||||||
}
|
}
|
||||||
@ -137,7 +138,8 @@ public class TickerTask implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tickers.add(item.getBlockTicker());
|
tickers.add(item.getBlockTicker());
|
||||||
} catch (Exception x) {
|
}
|
||||||
|
catch (Exception x) {
|
||||||
int errors = bugged.getOrDefault(l, 0);
|
int errors = bugged.getOrDefault(l, 0);
|
||||||
reportErrors(l, item, x, errors);
|
reportErrors(l, item, x, errors);
|
||||||
}
|
}
|
||||||
@ -181,7 +183,7 @@ public class TickerTask implements Runnable {
|
|||||||
buggedBlocks.put(l, errors);
|
buggedBlocks.put(l, errors);
|
||||||
}
|
}
|
||||||
else if (errors == 4) {
|
else if (errors == 4) {
|
||||||
Slimefun.getLogger().log(Level.SEVERE, "X: " + l.getBlockX() + " Y: " + l.getBlockY() + " Z: " + l.getBlockZ() + '(' + item.getID() + ")");
|
Slimefun.getLogger().log(Level.SEVERE, "X: {0} Y: {1} Z: {2} ({3})", new Object[] { l.getBlockX(), l.getBlockY(), l.getBlockZ(), item.getID() });
|
||||||
Slimefun.getLogger().log(Level.SEVERE, "has thrown 4 Exceptions in the last 4 Ticks, the Block has been terminated.");
|
Slimefun.getLogger().log(Level.SEVERE, "has thrown 4 Exceptions in the last 4 Ticks, the Block has been terminated.");
|
||||||
Slimefun.getLogger().log(Level.SEVERE, "Check your /plugins/Slimefun/error-reports/ folder for details.");
|
Slimefun.getLogger().log(Level.SEVERE, "Check your /plugins/Slimefun/error-reports/ folder for details.");
|
||||||
Slimefun.getLogger().log(Level.SEVERE, " ");
|
Slimefun.getLogger().log(Level.SEVERE, " ");
|
||||||
@ -210,10 +212,7 @@ public class TickerTask implements Runnable {
|
|||||||
sender.sendMessage("");
|
sender.sendMessage("");
|
||||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&6Ticking Machines:"));
|
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&6Ticking Machines:"));
|
||||||
|
|
||||||
List<Map.Entry<String, Long>> timings = machineCount.keySet().stream()
|
List<Map.Entry<String, Long>> timings = machineCount.keySet().stream().map(key -> new AbstractMap.SimpleEntry<>(key, machineTimings.getOrDefault(key, 0L))).sorted((o1, o2) -> o2.getValue().compareTo(o1.getValue())).collect(Collectors.toList());
|
||||||
.map(key -> new AbstractMap.SimpleEntry<>(key, machineTimings.getOrDefault(key, 0L)))
|
|
||||||
.sorted((o1, o2) -> o2.getValue().compareTo(o1.getValue()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
ChatComponent component = new ChatComponent(ChatColors.color(" &7&oHover for more Info"));
|
ChatComponent component = new ChatComponent(ChatColors.color(" &7&oHover for more Info"));
|
||||||
@ -224,15 +223,7 @@ public class TickerTask implements Runnable {
|
|||||||
int count = machineCount.get(entry.getKey());
|
int count = machineCount.get(entry.getKey());
|
||||||
|
|
||||||
if (entry.getValue() > 500_000) {
|
if (entry.getValue() > 500_000) {
|
||||||
builder.append("\n&c")
|
builder.append("\n&c").append(entry.getKey()).append(" - ").append(count).append("x &7(").append(toMillis(entry.getValue())).append(", ").append(toMillis(entry.getValue() / count)).append(" avg/machine)");
|
||||||
.append(entry.getKey())
|
|
||||||
.append(" - ")
|
|
||||||
.append(count)
|
|
||||||
.append("x &7(")
|
|
||||||
.append(toMillis(entry.getValue()))
|
|
||||||
.append(", ")
|
|
||||||
.append(toMillis(entry.getValue() / count))
|
|
||||||
.append(" avg/machine)");
|
|
||||||
}
|
}
|
||||||
else hidden++;
|
else hidden++;
|
||||||
}
|
}
|
||||||
@ -259,9 +250,7 @@ public class TickerTask implements Runnable {
|
|||||||
sender.sendMessage("");
|
sender.sendMessage("");
|
||||||
sender.sendMessage(ChatColors.color("&6Ticking Chunks:"));
|
sender.sendMessage(ChatColors.color("&6Ticking Chunks:"));
|
||||||
|
|
||||||
timings = chunkTimings.entrySet().stream()
|
timings = chunkTimings.entrySet().stream().sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).collect(Collectors.toList());
|
||||||
.sorted(Map.Entry.comparingByValue(Comparator.reverseOrder()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
ChatComponent component = new ChatComponent(ChatColors.color(" &7&oHover for more Info"));
|
ChatComponent component = new ChatComponent(ChatColors.color(" &7&oHover for more Info"));
|
||||||
@ -271,13 +260,7 @@ public class TickerTask implements Runnable {
|
|||||||
for (Map.Entry<String, Long> entry : timings) {
|
for (Map.Entry<String, Long> entry : timings) {
|
||||||
if (!chunksSkipped.contains(entry.getKey())) {
|
if (!chunksSkipped.contains(entry.getKey())) {
|
||||||
if (entry.getValue() > 0) {
|
if (entry.getValue() > 0) {
|
||||||
builder.append("\n&c")
|
builder.append("\n&c").append(formatChunk(entry.getKey())).append(" - ").append(chunkItemCount.getOrDefault(entry.getKey(), 0)).append("x &7(").append(toMillis(entry.getValue())).append(')');
|
||||||
.append(formatChunk(entry.getKey()))
|
|
||||||
.append(" - ")
|
|
||||||
.append(chunkItemCount.getOrDefault(entry.getKey(), 0))
|
|
||||||
.append("x &7(")
|
|
||||||
.append(toMillis(entry.getValue()))
|
|
||||||
.append(')');
|
|
||||||
}
|
}
|
||||||
else hidden++;
|
else hidden++;
|
||||||
}
|
}
|
||||||
@ -339,17 +322,7 @@ public class TickerTask implements Runnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "TickerTask {\n"
|
return "TickerTask {\n" + " HALTED = " + halted + "\n" + " tickers = " + tickers + "\n" + " move = " + move + "\n" + " delete = " + delete + "\n" + " chunks = " + chunkItemCount + "\n" + " machines = " + machineCount + "\n" + " machinetime = " + machineTimings + "\n" + " chunktime = " + chunkTimings + "\n" + " skipped = " + chunksSkipped + "\n" + "}";
|
||||||
+ " HALTED = " + halted + "\n"
|
|
||||||
+ " tickers = " + tickers + "\n"
|
|
||||||
+ " move = " + move + "\n"
|
|
||||||
+ " delete = " + delete + "\n"
|
|
||||||
+ " chunks = " + chunkItemCount + "\n"
|
|
||||||
+ " machines = " + machineCount + "\n"
|
|
||||||
+ " machinetime = " + machineTimings + "\n"
|
|
||||||
+ " chunktime = " + chunkTimings + "\n"
|
|
||||||
+ " skipped = " + chunksSkipped + "\n"
|
|
||||||
+ "}";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void queueMove(Location from, Location to) {
|
public void queueMove(Location from, Location to) {
|
||||||
|
@ -25,7 +25,7 @@ public final class NumberUtils {
|
|||||||
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(date.replace('T', ' ').replace("Z", ""));
|
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(date.replace('T', ' ').replace("Z", ""));
|
||||||
}
|
}
|
||||||
catch (ParseException x) {
|
catch (ParseException x) {
|
||||||
Slimefun.getLogger().log(Level.SEVERE, "An Error occured while parsing a GitHub-Date for Slimefun " + SlimefunPlugin.getVersion(), x);
|
Slimefun.getLogger().log(Level.SEVERE, x, () -> "An Error occured while parsing a GitHub-Date for Slimefun " + SlimefunPlugin.getVersion());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@ import java.util.List;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Keyed;
|
import org.bukkit.Keyed;
|
||||||
@ -25,7 +24,6 @@ import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
|||||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunMachine;
|
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunMachine;
|
||||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.MultiBlockMachine;
|
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.MultiBlockMachine;
|
||||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
|
||||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||||
|
|
||||||
public class RecipeType implements Keyed {
|
public class RecipeType implements Keyed {
|
||||||
@ -153,19 +151,12 @@ public class RecipeType implements Keyed {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void registerMobDrop(ItemStack[] recipe, ItemStack output) {
|
private static void registerMobDrop(ItemStack[] recipe, ItemStack output) {
|
||||||
String mob = null;
|
String mob = ChatColor.stripColor(recipe[4].getItemMeta().getDisplayName()).toUpperCase().replace(' ', '_');
|
||||||
|
|
||||||
try {
|
|
||||||
mob = ChatColor.stripColor(recipe[4].getItemMeta().getDisplayName()).toUpperCase().replace(' ', '_');
|
|
||||||
EntityType entity = EntityType.valueOf(mob);
|
EntityType entity = EntityType.valueOf(mob);
|
||||||
Set<ItemStack> dropping = SlimefunPlugin.getRegistry().getMobDrops().getOrDefault(entity, new HashSet<>());
|
Set<ItemStack> dropping = SlimefunPlugin.getRegistry().getMobDrops().getOrDefault(entity, new HashSet<>());
|
||||||
dropping.add(output);
|
dropping.add(output);
|
||||||
SlimefunPlugin.getRegistry().getMobDrops().put(entity, dropping);
|
SlimefunPlugin.getRegistry().getMobDrops().put(entity, dropping);
|
||||||
}
|
}
|
||||||
catch (Exception x) {
|
|
||||||
Slimefun.getLogger().log(Level.WARNING, "An Exception occured when setting a Drop for the Mob Type: \"" + mob + "\"", x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<ItemStack> getRecipeInputs(SlimefunMachine machine) {
|
public static List<ItemStack> getRecipeInputs(SlimefunMachine machine) {
|
||||||
if (machine == null) return new ArrayList<>();
|
if (machine == null) return new ArrayList<>();
|
||||||
|
@ -2,7 +2,6 @@ package me.mrCookieSlime.Slimefun.Objects.SlimefunItem;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
@ -188,7 +188,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
|
|||||||
SlimefunItemSetup.setup(this);
|
SlimefunItemSetup.setup(this);
|
||||||
}
|
}
|
||||||
catch (Throwable x) {
|
catch (Throwable x) {
|
||||||
getLogger().log(Level.SEVERE, "An Error occured while initializing SlimefunItems for Slimefun " + getVersion(), x);
|
getLogger().log(Level.SEVERE, x, () -> "An Error occured while initializing SlimefunItems for Slimefun " + getVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
getLogger().log(Level.INFO, "Loading Researches...");
|
getLogger().log(Level.INFO, "Loading Researches...");
|
||||||
@ -197,7 +197,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
|
|||||||
ResearchSetup.setupResearches();
|
ResearchSetup.setupResearches();
|
||||||
}
|
}
|
||||||
catch (Throwable x) {
|
catch (Throwable x) {
|
||||||
getLogger().log(Level.SEVERE, "An Error occured while initializing Slimefun Researches for Slimefun " + getVersion(), x);
|
getLogger().log(Level.SEVERE, x, () -> "An Error occured while initializing Slimefun Researches for Slimefun " + getVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
registry.setResearchingEnabled(getResearchCfg().getBoolean("enable-researching"));
|
registry.setResearchingEnabled(getResearchCfg().getBoolean("enable-researching"));
|
||||||
@ -313,8 +313,8 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
|
|||||||
try {
|
try {
|
||||||
ticker.run();
|
ticker.run();
|
||||||
}
|
}
|
||||||
catch (Exception x) {
|
catch (Throwable x) {
|
||||||
getLogger().log(Level.SEVERE, "An Exception was caught while ticking the Block Tickers Task for Slimefun v" + getVersion(), x);
|
getLogger().log(Level.SEVERE, x, () -> "An Exception was caught while ticking the Block Tickers Task for Slimefun v" + getVersion());
|
||||||
ticker.abortTick();
|
ticker.abortTick();
|
||||||
}
|
}
|
||||||
}, 100L, config.getInt("URID.custom-ticker-delay"));
|
}, 100L, config.getInt("URID.custom-ticker-delay"));
|
||||||
@ -370,8 +370,8 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
|
|||||||
getLogger().log(Level.SEVERE, "### Slimefun was not installed correctly!");
|
getLogger().log(Level.SEVERE, "### Slimefun was not installed correctly!");
|
||||||
getLogger().log(Level.SEVERE, "### You are using the wrong version of Minecraft!");
|
getLogger().log(Level.SEVERE, "### You are using the wrong version of Minecraft!");
|
||||||
getLogger().log(Level.SEVERE, "###");
|
getLogger().log(Level.SEVERE, "###");
|
||||||
getLogger().log(Level.SEVERE, "### You are using Minecraft " + ReflectionUtils.getVersion());
|
getLogger().log(Level.SEVERE, "### You are using Minecraft {0}", ReflectionUtils.getVersion());
|
||||||
getLogger().log(Level.SEVERE, "### but Slimefun v" + getDescription().getVersion() + " requires you to be using");
|
getLogger().log(Level.SEVERE, "### but Slimefun v{0} requires you to be using", getDescription().getVersion());
|
||||||
getLogger().log(Level.SEVERE, "### Minecraft {0}", String.join(" / ", MinecraftVersion.getSupportedVersions()));
|
getLogger().log(Level.SEVERE, "### Minecraft {0}", String.join(" / ", MinecraftVersion.getSupportedVersions()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -409,11 +409,11 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
|
|||||||
storage.save(true);
|
storage.save(true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
getLogger().log(Level.SEVERE, "Could not save Slimefun Blocks for World \"" + world.getName() + "\"");
|
getLogger().log(Level.SEVERE, "Could not save Slimefun Blocks for World \"{0}\"", world.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception x) {
|
catch (Exception x) {
|
||||||
getLogger().log(Level.SEVERE, "An Error occured while saving Slimefun-Blocks in World '" + world.getName() + "' for Slimefun " + getVersion(), x);
|
getLogger().log(Level.SEVERE, x, () -> "An Error occured while saving Slimefun-Blocks in World '" + world.getName() + "' for Slimefun " + getVersion());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
|
||||||
import me.mrCookieSlime.CSCoreLibPlugin.PlayerRunnable;
|
import me.mrCookieSlime.CSCoreLibPlugin.PlayerRunnable;
|
||||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
||||||
|
|
||||||
@ -12,8 +11,11 @@ import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
|||||||
public interface GuideHandler {
|
public interface GuideHandler {
|
||||||
|
|
||||||
public abstract void addEntry(List<String> texts, List<String> tooltips);
|
public abstract void addEntry(List<String> texts, List<String> tooltips);
|
||||||
|
|
||||||
public abstract PlayerRunnable getRunnable();
|
public abstract PlayerRunnable getRunnable();
|
||||||
|
|
||||||
public abstract int getTier();
|
public abstract int getTier();
|
||||||
|
|
||||||
public abstract boolean trackHistory();
|
public abstract boolean trackHistory();
|
||||||
|
|
||||||
public abstract int next(Player p, int index, ChestMenu menu);
|
public abstract int next(Player p, int index, ChestMenu menu);
|
||||||
@ -24,10 +26,6 @@ public interface GuideHandler {
|
|||||||
|
|
||||||
default void run(Player p, boolean survival, boolean book) {
|
default void run(Player p, boolean survival, boolean book) {
|
||||||
this.getRunnable(book).run(p);
|
this.getRunnable(book).run(p);
|
||||||
|
|
||||||
if (survival && this.trackHistory()) {
|
|
||||||
PlayerProfile.get(p, profile -> profile.getGuideHistory().add(this));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,26 +19,24 @@ import org.bukkit.potion.PotionEffectType;
|
|||||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||||
import io.github.thebusybiscuit.cscorelib2.item.ImmutableItemMeta;
|
import io.github.thebusybiscuit.cscorelib2.item.ImmutableItemMeta;
|
||||||
import io.github.thebusybiscuit.cscorelib2.skull.SkullItem;
|
import io.github.thebusybiscuit.cscorelib2.skull.SkullItem;
|
||||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
|
||||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||||
|
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||||
|
|
||||||
public class SlimefunItemStack extends CustomItem {
|
public class SlimefunItemStack extends CustomItem {
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
private ImmutableItemMeta immutableMeta;
|
private ImmutableItemMeta immutableMeta;
|
||||||
|
|
||||||
private final String texture;
|
private String texture = null;
|
||||||
|
|
||||||
public SlimefunItemStack(String id, Material type, String name, String... lore) {
|
public SlimefunItemStack(String id, Material type, String name, String... lore) {
|
||||||
super(type, name, lore);
|
super(type, name, lore);
|
||||||
texture = null;
|
|
||||||
|
|
||||||
setID(id);
|
setID(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SlimefunItemStack(String id, Material type, Color color, String name, String... lore) {
|
public SlimefunItemStack(String id, Material type, Color color, String name, String... lore) {
|
||||||
super(new ItemStack(type), color, name, lore);
|
super(new ItemStack(type), color, name, lore);
|
||||||
texture = null;
|
|
||||||
|
|
||||||
setID(id);
|
setID(id);
|
||||||
}
|
}
|
||||||
@ -69,28 +67,23 @@ public class SlimefunItemStack extends CustomItem {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
texture = null;
|
|
||||||
|
|
||||||
setID(id);
|
setID(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SlimefunItemStack(String id, ItemStack item, String name, String... lore) {
|
public SlimefunItemStack(String id, ItemStack item, String name, String... lore) {
|
||||||
super(item, name, lore);
|
super(item, name, lore);
|
||||||
texture = null;
|
|
||||||
|
|
||||||
setID(id);
|
setID(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SlimefunItemStack(String id, ItemStack item) {
|
public SlimefunItemStack(String id, ItemStack item) {
|
||||||
super(item);
|
super(item);
|
||||||
texture = null;
|
|
||||||
|
|
||||||
setID(id);
|
setID(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SlimefunItemStack(String id, ItemStack item, Consumer<ItemMeta> consumer) {
|
public SlimefunItemStack(String id, ItemStack item, Consumer<ItemMeta> consumer) {
|
||||||
super(item, consumer);
|
super(item, consumer);
|
||||||
texture = null;
|
|
||||||
|
|
||||||
setID(id);
|
setID(id);
|
||||||
}
|
}
|
||||||
@ -104,13 +97,12 @@ public class SlimefunItemStack extends CustomItem {
|
|||||||
consumer.accept(meta);
|
consumer.accept(meta);
|
||||||
});
|
});
|
||||||
|
|
||||||
texture = null;
|
|
||||||
setID(id);
|
setID(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SlimefunItemStack(String id, String texture, String name, String... lore) {
|
public SlimefunItemStack(String id, String texture, String name, String... lore) {
|
||||||
super(getSkull(texture), name, lore);
|
super(getSkull(texture), name, lore);
|
||||||
this.texture = texture;
|
this.texture = getTexture(texture);
|
||||||
|
|
||||||
setID(id);
|
setID(id);
|
||||||
}
|
}
|
||||||
@ -124,14 +116,14 @@ public class SlimefunItemStack extends CustomItem {
|
|||||||
consumer.accept(meta);
|
consumer.accept(meta);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.texture = texture;
|
this.texture = getTexture(texture);
|
||||||
|
|
||||||
setID(id);
|
setID(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SlimefunItemStack(String id, String texture, Consumer<ItemMeta> consumer) {
|
public SlimefunItemStack(String id, String texture, Consumer<ItemMeta> consumer) {
|
||||||
super(getSkull(texture), consumer);
|
super(getSkull(texture), consumer);
|
||||||
this.texture = texture;
|
this.texture = getTexture(texture);
|
||||||
|
|
||||||
setID(id);
|
setID(id);
|
||||||
}
|
}
|
||||||
@ -178,11 +170,15 @@ public class SlimefunItemStack extends CustomItem {
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<String> getBase64Texture() {
|
public Optional<String> getSkullTexture() {
|
||||||
return Optional.ofNullable(texture);
|
return Optional.ofNullable(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ItemStack getSkull(String texture) {
|
private static ItemStack getSkull(String texture) {
|
||||||
|
return SkullItem.fromBase64(getTexture(texture));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getTexture(String texture) {
|
||||||
String base64 = texture;
|
String base64 = texture;
|
||||||
|
|
||||||
// At this point we can be sure it's not a base64 encoded texture
|
// At this point we can be sure it's not a base64 encoded texture
|
||||||
@ -190,7 +186,7 @@ public class SlimefunItemStack extends CustomItem {
|
|||||||
base64 = Base64.getEncoder().encodeToString(("{\"textures\":{\"SKIN\":{\"url\":\"http://textures.minecraft.net/texture/" + texture + "\"}}}").getBytes());
|
base64 = Base64.getEncoder().encodeToString(("{\"textures\":{\"SKIN\":{\"url\":\"http://textures.minecraft.net/texture/" + texture + "\"}}}").getBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
return SkullItem.fromBase64(base64);
|
return base64;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ public class CargoNet extends Network {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Chest Terminal Code
|
// Chest Terminal Code
|
||||||
if (SlimefunPlugin.getNetworkManager().isChestTerminalInstalled()) {
|
if (SlimefunPlugin.getThirdPartySupportService().isChestTerminalInstalled()) {
|
||||||
for (Location bus : imports) {
|
for (Location bus : imports) {
|
||||||
BlockMenu menu = BlockStorage.getInventory(bus);
|
BlockMenu menu = BlockStorage.getInventory(bus);
|
||||||
|
|
||||||
@ -408,7 +408,7 @@ public class CargoNet extends Network {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Chest Terminal Code
|
// Chest Terminal Code
|
||||||
if (SlimefunPlugin.getNetworkManager().isChestTerminalInstalled()) {
|
if (SlimefunPlugin.getThirdPartySupportService().isChestTerminalInstalled()) {
|
||||||
List<ItemStackAndInteger> items = new ArrayList<>();
|
List<ItemStackAndInteger> items = new ArrayList<>();
|
||||||
|
|
||||||
for (Location l : providers) {
|
for (Location l : providers) {
|
||||||
|
Loading…
Reference in New Issue
Block a user