mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
[CI skip] Refactoring and documentation [javadocs]
This commit is contained in:
parent
2a0c3ff93c
commit
0babf64d62
24
pom.xml
24
pom.xml
@ -111,6 +111,28 @@
|
||||
<links>
|
||||
<link>https://hub.spigotmc.org/javadocs/bukkit/</link>
|
||||
</links>
|
||||
<groups>
|
||||
<group>
|
||||
<title>Slimefun4 - API</title>
|
||||
<packages>io.github.thebusybiscuit.slimefun4.api*</packages>
|
||||
</group>
|
||||
<group>
|
||||
<title>Slimefun4 - Core packages</title>
|
||||
<packages>io.github.thebusybiscuit.slimefun4.core*</packages>
|
||||
</group>
|
||||
<group>
|
||||
<title>Slimefun4 - Implementations</title>
|
||||
<packages>io.github.thebusybiscuit.slimefun4.implementation*</packages>
|
||||
</group>
|
||||
<group>
|
||||
<title>Slimefun4 - Item Implementations</title>
|
||||
<packages>io.github.thebusybiscuit.slimefun4.implementation.items*</packages>
|
||||
</group>
|
||||
<group>
|
||||
<title>Slimefun4 - Old packages</title>
|
||||
<packages>me.mrCookieSlime.Slimefun*</packages>
|
||||
</group>
|
||||
</groups>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
@ -144,7 +166,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.thebusybiscuit</groupId>
|
||||
<artifactId>CS-CoreLib2</artifactId>
|
||||
<version>0.9.2</version>
|
||||
<version>b1f4b0fd8b</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -26,7 +26,7 @@ import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
/**
|
||||
* This clas represents an {@link ErrorReport}.
|
||||
* This class represents an {@link ErrorReport}.
|
||||
* Error reports are thrown when a {@link BlockTicker} is causing problems.
|
||||
* To ensure that the console doesn't get too spammy, we destroy the block and generate
|
||||
* an {@link ErrorReport} instead.
|
||||
|
@ -1,8 +1,6 @@
|
||||
package me.mrCookieSlime.Slimefun;
|
||||
package io.github.thebusybiscuit.slimefun4.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
|
||||
/**
|
||||
* This enum holds all versions of Minecraft that we currently support.
|
||||
@ -62,16 +60,20 @@ public enum MinecraftVersion {
|
||||
return version.startsWith(prefix);
|
||||
}
|
||||
|
||||
static Collection<String> getSupportedVersions() {
|
||||
List<String> list = new ArrayList<>();
|
||||
|
||||
for (MinecraftVersion version : values()) {
|
||||
if (version != UNKNOWN) {
|
||||
list.add(version.getName());
|
||||
}
|
||||
/**
|
||||
* This method checks whether this {@link MinecraftVersion} is newer or equal to
|
||||
* the given {@link MinecraftVersion},
|
||||
*
|
||||
* @param version
|
||||
* The {@link MinecraftVersion} to compare
|
||||
* @return Whether this {@link MinecraftVersion} is newer or equal to the given {@link MinecraftVersion}
|
||||
*/
|
||||
public boolean isAtLeast(MinecraftVersion version) {
|
||||
if (this == UNKNOWN) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return list;
|
||||
return ordinal() >= version.ordinal();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* This package stores classes of the API that are related to the
|
||||
* {@link io.github.thebusybiscuit.slimefun4.api.gps.GPSNetwork}.
|
||||
*/
|
||||
package io.github.thebusybiscuit.slimefun4.api.gps;
|
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* This package stores API-related classes that are related to a {@link org.bukkit.entity.Player},
|
||||
* such as the {@link io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile} for example.
|
||||
*/
|
||||
package io.github.thebusybiscuit.slimefun4.api.player;
|
@ -31,9 +31,9 @@ import me.mrCookieSlime.Slimefun.Objects.handlers.MultiBlockInteractionHandler;
|
||||
public class MultiBlock {
|
||||
|
||||
public static final List<Tag<Material>> SUPPORTED_TAGS = Arrays.asList(
|
||||
Tag.LOGS,
|
||||
Tag.WOODEN_FENCES,
|
||||
Tag.WOODEN_TRAPDOORS,
|
||||
Tag.LOGS,
|
||||
Tag.WOODEN_TRAPDOORS,
|
||||
Tag.WOODEN_FENCES,
|
||||
Tag.WOODEN_SLABS
|
||||
);
|
||||
|
||||
|
@ -7,6 +7,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.Damageable;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.config.Config;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
|
||||
/**
|
||||
@ -22,6 +23,13 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
@FunctionalInterface
|
||||
public interface DamageableItem extends ItemAttribute {
|
||||
|
||||
/**
|
||||
* Implement this method to make the behaviour of this interface dependent
|
||||
* on the state of your object.
|
||||
* You could add a {@link Config} option to toggle the behaviour for example.
|
||||
*
|
||||
* @return Whether this {@link SlimefunItem} is damageable
|
||||
*/
|
||||
boolean isDamageable();
|
||||
|
||||
default void damageItem(Player p, ItemStack item) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package io.github.thebusybiscuit.slimefun4.core.attributes;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler;
|
||||
|
||||
/**
|
||||
* An empty interface that only serves the purpose of bundling together all
|
||||
@ -11,6 +12,7 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
* @see SlimefunItem
|
||||
* @see ItemHandler
|
||||
*
|
||||
*/
|
||||
public interface ItemAttribute {
|
||||
|
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* This package holds all implementations of {@link io.github.thebusybiscuit.slimefun4.core.commands.SubCommand}.
|
||||
* You can find all sub commands of Slimefun in here.
|
||||
*/
|
||||
package io.github.thebusybiscuit.slimefun4.core.commands.subcommands;
|
@ -25,26 +25,67 @@ public class GuideHistory {
|
||||
private final PlayerProfile profile;
|
||||
private final Deque<GuideEntry<?>> queue = new LinkedList<>();
|
||||
|
||||
/**
|
||||
* This creates a new {@link GuideHistory} for the given {@link PlayerProfile}
|
||||
*
|
||||
* @param profile
|
||||
* The {@link PlayerProfile} this {@link GuideHistory} was made for
|
||||
*/
|
||||
public GuideHistory(PlayerProfile profile) {
|
||||
this.profile = profile;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will clear this {@link GuideHistory} and remove all entries.
|
||||
*/
|
||||
public void clear() {
|
||||
queue.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method adds a {@link Category} to this {@link GuideHistory}.
|
||||
* Should the {@link Category} already be the last element in this {@link GuideHistory},
|
||||
* then the entry will be overridden with the new page.
|
||||
*
|
||||
* @param category
|
||||
* The {@link Category} that should be added to this {@link GuideHistory}
|
||||
* @param page
|
||||
* The current page of the {@link Category} that should be stored
|
||||
*/
|
||||
public void add(Category category, int page) {
|
||||
refresh(category, page);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method adds a {@link ItemStack} to this {@link GuideHistory}.
|
||||
* Should the {@link ItemStack} already be the last element in this {@link GuideHistory},
|
||||
* then the entry will be overridden with the new page.
|
||||
*
|
||||
* @param item
|
||||
* The {@link ItemStack} that should be added to this {@link GuideHistory}
|
||||
* @param page
|
||||
* The current page of the recipes of this {@link ItemStack}
|
||||
*/
|
||||
public void add(ItemStack item, int page) {
|
||||
refresh(item, page);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method stores the given {@link SlimefunItem} in this {@link GuideHistory}.
|
||||
*
|
||||
* @param item
|
||||
* The {@link SlimefunItem} that should be added to this {@link GuideHistory}
|
||||
*/
|
||||
public void add(SlimefunItem item) {
|
||||
queue.add(new GuideEntry<>(item, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* This method stores the given search term in this {@link GuideHistory}.
|
||||
*
|
||||
* @param searchTerm
|
||||
* The term that the {@link Player} searched for
|
||||
*/
|
||||
public void add(String searchTerm) {
|
||||
queue.add(new GuideEntry<>(searchTerm, 0));
|
||||
}
|
||||
@ -60,6 +101,11 @@ public class GuideHistory {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns the amount of elements in this {@link GuideHistory}.
|
||||
*
|
||||
* @return The size of this {@link GuideHistory}
|
||||
*/
|
||||
public int size() {
|
||||
return queue.size();
|
||||
}
|
||||
@ -80,11 +126,32 @@ public class GuideHistory {
|
||||
return queue.isEmpty() ? null : queue.getLast();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method opens the last opened entry to the associated {@link PlayerProfile}
|
||||
* of this {@link GuideHistory}.
|
||||
*
|
||||
* @param guide
|
||||
* The {@link SlimefunGuideImplementation} to use
|
||||
* @param survival
|
||||
* Whether the entry should be opened in survival or creative mode
|
||||
*/
|
||||
public void openLastEntry(SlimefunGuideImplementation guide, boolean survival) {
|
||||
GuideEntry<?> entry = getLastEntry(false);
|
||||
open(guide, entry, survival);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method opens the previous entry to the associated {@link PlayerProfile}.
|
||||
* More precisely, it will remove the last entry and open the second-last entry
|
||||
* to the {@link Player}.
|
||||
*
|
||||
* It can be thought of as a "back" button. Since that is what this is used for.
|
||||
*
|
||||
* @param guide
|
||||
* The {@link SlimefunGuideImplementation} to use
|
||||
* @param survival
|
||||
* Whether the entry should be opened in survival or creative mode
|
||||
*/
|
||||
public void goBack(SlimefunGuideImplementation guide, boolean survival) {
|
||||
GuideEntry<?> entry = getLastEntry(true);
|
||||
open(guide, entry, survival);
|
||||
|
@ -343,4 +343,8 @@ public final class SlimefunGuideSettings {
|
||||
return SlimefunGuide.getItem(layout);
|
||||
}
|
||||
|
||||
public static boolean hasFireworksEnabled(Player p) {
|
||||
return !PersistentDataAPI.hasByte(p, FIREWORKS_KEY) || PersistentDataAPI.getByte(p, FIREWORKS_KEY) == (byte) 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* This package holds an implementation of {@link io.github.thebusybiscuit.slimefun4.api.network.Network}
|
||||
* that is responsible for item transportation.
|
||||
*/
|
||||
package io.github.thebusybiscuit.slimefun4.core.networks.cargo;
|
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* This package holds an implementation of {@link io.github.thebusybiscuit.slimefun4.api.network.Network}
|
||||
* that is responsible for transmitting energy.
|
||||
*/
|
||||
package io.github.thebusybiscuit.slimefun4.core.networks.energy;
|
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* This package holds the core systems of Slimefun, these are not neccessarily used as an API
|
||||
* but ratherprovide the core functionality of this {@link org.bukkit.plugin.Plugin}.
|
||||
*/
|
||||
package io.github.thebusybiscuit.slimefun4.core;
|
@ -2,7 +2,9 @@ package io.github.thebusybiscuit.slimefun4.core.services;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.TileState;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
@ -16,13 +18,27 @@ public class BlockDataService {
|
||||
namespacedKey = new NamespacedKey(plugin, key);
|
||||
}
|
||||
|
||||
public void setBlockData(TileState tileEntity, String value) {
|
||||
public void setBlockData(Block b, String value) {
|
||||
TileState tileEntity = (TileState) b.getState();
|
||||
PersistentDataAPI.setString(tileEntity, namespacedKey, value);
|
||||
tileEntity.update();
|
||||
}
|
||||
|
||||
public Optional<String> getBlockData(TileState tileEntity) {
|
||||
return PersistentDataAPI.getOptionalString(tileEntity, namespacedKey);
|
||||
public Optional<String> getBlockData(Block b) {
|
||||
return PersistentDataAPI.getOptionalString((TileState) b.getState(), namespacedKey);
|
||||
}
|
||||
|
||||
public boolean isTileEntity(Material type) {
|
||||
switch (type) {
|
||||
case PLAYER_HEAD:
|
||||
case PLAYER_WALL_HEAD:
|
||||
case CHEST:
|
||||
case DISPENSER:
|
||||
case DROPPER:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -29,12 +29,7 @@ public class CustomTextureService {
|
||||
public void load() {
|
||||
config = new Config(plugin, "item-models.yml");
|
||||
|
||||
config.getConfiguration().options().header(
|
||||
"This file is used to assign items from Slimefun or any of its addons\n" +
|
||||
"the 'CustomModelData' NBT tag. This can be used in conjunction with a custom resource pack\n" +
|
||||
"to give items custom textures.\n\n" +
|
||||
"There is no official Slimefun resource pack at the moment."
|
||||
);
|
||||
config.getConfiguration().options().header("This file is used to assign items from Slimefun or any of its addons\n" + "the 'CustomModelData' NBT tag. This can be used in conjunction with a custom resource pack\n" + "to give items custom textures.\n\n" + "There is no official Slimefun resource pack at the moment.");
|
||||
|
||||
config.getConfiguration().options().copyHeader(true);
|
||||
}
|
||||
|
@ -50,10 +50,12 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
private static final int CATEGORY_SIZE = 36;
|
||||
|
||||
private final int[] recipeSlots = { 3, 4, 5, 12, 13, 14, 21, 22, 23 };
|
||||
private final Sound sound;
|
||||
private final boolean showVanillaRecipes;
|
||||
|
||||
public ChestSlimefunGuide(boolean showVanillaRecipes) {
|
||||
this.showVanillaRecipes = showVanillaRecipes;
|
||||
this.sound = Sound.ITEM_BOOK_PAGE_TURN;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -448,12 +450,13 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
ItemStack[] recipe = item.getRecipe();
|
||||
|
||||
ChestMenu menu = create(p);
|
||||
|
||||
if (item.hasWikipage()) {
|
||||
Optional<String> wiki = item.getWikipage();
|
||||
|
||||
if (wiki.isPresent()) {
|
||||
menu.addItem(8, new CustomItem(Material.KNOWLEDGE_BOOK, ChatColor.RESET + SlimefunPlugin.getLocal().getMessage(p, "guide.tooltips.wiki"), "", ChatColor.GRAY + "\u21E8 " + ChatColor.GREEN + SlimefunPlugin.getLocal().getMessage(p, "guide.tooltips.open-category")));
|
||||
menu.addMenuClickHandler(8, (pl, slot, itemstack, action) -> {
|
||||
pl.closeInventory();
|
||||
ChatUtils.sendURL(pl, item.getWikipage());
|
||||
ChatUtils.sendURL(pl, wiki.get());
|
||||
return false;
|
||||
});
|
||||
}
|
||||
@ -591,7 +594,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
menu.addMenuClickHandler(28, (pl, slot, itemstack, action) -> {
|
||||
if (page > 0) {
|
||||
displayRecipes(pl, profile, menu, sfItem, page - 1);
|
||||
pl.playSound(pl.getLocation(), Sound.ITEM_BOOK_PAGE_TURN, 1, 1);
|
||||
pl.playSound(pl.getLocation(), sound, 1, 1);
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -601,7 +604,7 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
menu.addMenuClickHandler(34, (pl, slot, itemstack, action) -> {
|
||||
if (recipes.size() > (18 * (page + 1))) {
|
||||
displayRecipes(pl, profile, menu, sfItem, page + 1);
|
||||
pl.playSound(pl.getLocation(), Sound.ITEM_BOOK_PAGE_TURN, 1, 1);
|
||||
pl.playSound(pl.getLocation(), sound, 1, 1);
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -640,11 +643,11 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
}
|
||||
}
|
||||
|
||||
private static ChestMenu create(Player p) {
|
||||
private ChestMenu create(Player p) {
|
||||
ChestMenu menu = new ChestMenu(SlimefunPlugin.getLocal().getMessage(p, "guide.title.main"));
|
||||
|
||||
menu.setEmptySlotsClickable(false);
|
||||
menu.addMenuOpeningHandler(pl -> pl.playSound(pl.getLocation(), Sound.ITEM_BOOK_PAGE_TURN, 1, 1));
|
||||
menu.addMenuOpeningHandler(pl -> pl.playSound(pl.getLocation(), sound, 1, 1));
|
||||
return menu;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,6 @@ public class EasterEgg extends SimpleSlimefunItem<ItemUseHandler> {
|
||||
}
|
||||
|
||||
FireworkUtils.launchRandom(p, 2);
|
||||
|
||||
p.getWorld().dropItemNaturally(p.getLocation(), gifts[ThreadLocalRandom.current().nextInt(gifts.length)].clone());
|
||||
};
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.items.altar;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
|
||||
public class AncientAltar extends SlimefunItem {
|
||||
|
||||
public AncientAltar(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||
super(category, item, recipeType, recipe);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* This package holds the {@link me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem} implementations related to
|
||||
* the {@link io.github.thebusybiscuit.slimefun4.implementation.items.altar.AncientAltar}.
|
||||
*/
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.items.altar;
|
@ -420,7 +420,7 @@ public abstract class ProgrammableAndroid extends Android implements InventoryBl
|
||||
menu.replaceExistingItem(43, new CustomItem(newFuel, currentFuel.getAmount() + amount));
|
||||
ItemUtils.consumeItem(newFuel, amount, false);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* This package holds implementations of {@link me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem}
|
||||
* that are related to the {@link io.github.thebusybiscuit.slimefun4.implementation.items.androids.ProgrammableAndroid}.
|
||||
*/
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.items.androids;
|
@ -92,8 +92,8 @@ public class BlockPlacer extends SimpleSlimefunItem<BlockDispenseHandler> {
|
||||
// applies to shulker boxes)
|
||||
// Inventory has to be changed after blockState.update() as updating it will create a different Inventory
|
||||
// for the object
|
||||
if (facedBlock.getState() instanceof BlockInventoryHolder) {
|
||||
((BlockInventoryHolder) facedBlock.getState()).getInventory().setContents(((BlockInventoryHolder) itemBlockState).getInventory().getContents());
|
||||
if (blockState instanceof BlockInventoryHolder) {
|
||||
((BlockInventoryHolder) blockState).getInventory().setContents(((BlockInventoryHolder) itemBlockState).getInventory().getContents());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
/**
|
||||
* This package provides the different implementations of
|
||||
* {@link me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem}
|
||||
* that are related to the {@link me.mrCookieSlime.Slimefun.api.item_transport.CargoNet}, most
|
||||
* notably: Cargo Nodes.
|
||||
*/
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.items.cargo;
|
@ -4,6 +4,8 @@ import org.bukkit.Material;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AGenerator;
|
||||
@ -40,13 +42,21 @@ public abstract class BioGenerator extends AGenerator {
|
||||
registerFuel(new MachineFuel(2, new ItemStack(Material.CACTUS)));
|
||||
registerFuel(new MachineFuel(2, new ItemStack(Material.LILY_PAD)));
|
||||
registerFuel(new MachineFuel(8, new ItemStack(Material.CHORUS_FRUIT)));
|
||||
registerFuel(new MachineFuel(1, new ItemStack(Material.BAMBOO)));
|
||||
registerFuel(new MachineFuel(1, new ItemStack(Material.KELP)));
|
||||
registerFuel(new MachineFuel(2, new ItemStack(Material.DRIED_KELP)));
|
||||
registerFuel(new MachineFuel(20, new ItemStack(Material.DRIED_KELP_BLOCK)));
|
||||
registerFuel(new MachineFuel(1, new ItemStack(Material.SEAGRASS)));
|
||||
registerFuel(new MachineFuel(2, new ItemStack(Material.SEA_PICKLE)));
|
||||
registerFuel(new MachineFuel(2, new ItemStack(Material.SWEET_BERRIES)));
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
registerFuel(new MachineFuel(1, new ItemStack(Material.BAMBOO)));
|
||||
registerFuel(new MachineFuel(2, new ItemStack(Material.SWEET_BERRIES)));
|
||||
|
||||
// Small Flowers (formally just dandelions and poppies).
|
||||
for (Material m : Tag.SMALL_FLOWERS.getValues()) {
|
||||
registerFuel(new MachineFuel(1, new ItemStack(m)));
|
||||
}
|
||||
}
|
||||
|
||||
// Leaves
|
||||
for (Material m : Tag.LEAVES.getValues()) {
|
||||
@ -57,11 +67,6 @@ public abstract class BioGenerator extends AGenerator {
|
||||
for (Material m : Tag.SAPLINGS.getValues()) {
|
||||
registerFuel(new MachineFuel(1, new ItemStack(m)));
|
||||
}
|
||||
|
||||
// Small Flowers (formally just dandelions and poppies).
|
||||
for (Material m : Tag.SMALL_FLOWERS.getValues()) {
|
||||
registerFuel(new MachineFuel(1, new ItemStack(m)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -10,10 +10,12 @@ import org.bukkit.block.data.Ageable;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent;
|
||||
import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
@ -41,7 +43,10 @@ public abstract class CropGrowthAccelerator extends SlimefunItem implements Inve
|
||||
crops.add(Material.NETHER_WART);
|
||||
crops.add(Material.BEETROOTS);
|
||||
crops.add(Material.COCOA);
|
||||
crops.add(Material.SWEET_BERRY_BUSH);
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
crops.add(Material.SWEET_BERRY_BUSH);
|
||||
}
|
||||
|
||||
createPreset(this, this::constructMenu);
|
||||
|
||||
|
@ -3,6 +3,8 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machine
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
@ -24,8 +26,11 @@ public abstract class FoodFabricator extends AContainer {
|
||||
registerRecipe(12, new ItemStack[] { SlimefunItems.CAN, new ItemStack(Material.BEETROOT) }, new ItemStack[] { SlimefunItems.BEETROOT_ORGANIC_FOOD });
|
||||
registerRecipe(12, new ItemStack[] { SlimefunItems.CAN, new ItemStack(Material.MELON) }, new ItemStack[] { SlimefunItems.MELON_ORGANIC_FOOD });
|
||||
registerRecipe(12, new ItemStack[] { SlimefunItems.CAN, new ItemStack(Material.APPLE) }, new ItemStack[] { SlimefunItems.APPLE_ORGANIC_FOOD });
|
||||
registerRecipe(12, new ItemStack[] { SlimefunItems.CAN, new ItemStack(Material.SWEET_BERRIES) }, new ItemStack[] { SlimefunItems.SWEET_BERRIES_ORGANIC_FOOD });
|
||||
registerRecipe(12, new ItemStack[] { SlimefunItems.CAN, new ItemStack(Material.DRIED_KELP) }, new ItemStack[] { SlimefunItems.KELP_ORGANIC_FOOD });
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
registerRecipe(12, new ItemStack[] { SlimefunItems.CAN, new ItemStack(Material.SWEET_BERRIES) }, new ItemStack[] { SlimefunItems.SWEET_BERRIES_ORGANIC_FOOD });
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* This package holds implementations of {@link me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem}
|
||||
* that are related to food.
|
||||
*/
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.items.food;
|
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* This package holds implementations of {@link me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem}
|
||||
* that are related to the {@link io.github.thebusybiscuit.slimefun4.api.gps.GPSNetwork}.
|
||||
*/
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.items.gps;
|
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* This package holds implementations of {@link me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem}
|
||||
* that are considered magical items.
|
||||
*/
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.items.magical;
|
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* This package holds implementations of {@link me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem} that are
|
||||
* related to healing yourself.
|
||||
*/
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.items.medical;
|
@ -23,7 +23,7 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.MultiBlockMach
|
||||
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager;
|
||||
|
||||
public class PressureChamber extends MultiBlockMachine {
|
||||
|
||||
|
||||
public PressureChamber() {
|
||||
super(Categories.MACHINES_1, SlimefunItems.PRESSURE_CHAMBER, new ItemStack[] { new ItemStack(Material.SMOOTH_STONE_SLAB), new CustomItem(Material.DISPENSER, "Dispenser (Facing down)"), new ItemStack(Material.SMOOTH_STONE_SLAB), new ItemStack(Material.PISTON), new ItemStack(Material.GLASS), new ItemStack(Material.PISTON), new ItemStack(Material.PISTON), new ItemStack(Material.CAULDRON), new ItemStack(Material.PISTON) }, new ItemStack[0], BlockFace.UP);
|
||||
}
|
||||
|
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* This package contains all the different implementations of
|
||||
* {@link me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.MultiBlockMachine}
|
||||
*/
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.items.multiblocks;
|
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* This package holds implementations of {@link me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem}
|
||||
* that are tools.
|
||||
*/
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.items.tools;
|
@ -0,0 +1,6 @@
|
||||
/**
|
||||
* This package holds implementations of {@link me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem}
|
||||
* that are weapons, implementations of
|
||||
* {@link io.github.thebusybiscuit.slimefun4.implementation.items.weapons.SlimefunBow} for example.
|
||||
*/
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.items.weapons;
|
@ -32,6 +32,8 @@ import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.api.events.PlayerRightClickEvent;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.altar.AltarRecipe;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.altar.AncientAltar;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.altar.AncientPedestal;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.tasks.AncientAltarTask;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
|
||||
@ -40,10 +42,16 @@ import me.mrCookieSlime.Slimefun.Setup.SlimefunManager;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
/**
|
||||
* This {@link Listener} is responsible for providing the core mechanics of the {@link AncientAltar}
|
||||
* and the {@link AncientPedestal}, it also handles the crafting of items using the Altar.
|
||||
*
|
||||
* @author Redemption198
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
*/
|
||||
public class AncientAltarListener implements Listener {
|
||||
|
||||
private static final String PEDESTAL_ID = "ANCIENT_PEDESTAL";
|
||||
|
||||
private final Set<AltarRecipe> altarRecipes = new HashSet<>();
|
||||
private final Set<Location> altarsInUse = new HashSet<>();
|
||||
|
||||
@ -58,6 +66,10 @@ public class AncientAltarListener implements Listener {
|
||||
return altarsInUse;
|
||||
}
|
||||
|
||||
public List<Block> getAltars() {
|
||||
return altars;
|
||||
}
|
||||
|
||||
public Set<AltarRecipe> getRecipes() {
|
||||
return altarRecipes;
|
||||
}
|
||||
@ -77,7 +89,7 @@ public class AncientAltarListener implements Listener {
|
||||
|
||||
String id = slimefunBlock.get().getID();
|
||||
|
||||
if (id.equals(PEDESTAL_ID)) {
|
||||
if (id.equals(SlimefunItems.ANCIENT_PEDESTAL.getItemID())) {
|
||||
e.cancel();
|
||||
|
||||
if (altarsInUse.contains(b.getLocation())) {
|
||||
@ -146,7 +158,7 @@ public class AncientAltarListener implements Listener {
|
||||
ItemUtils.consumeItem(e.getPlayer().getInventory().getItemInMainHand(), false);
|
||||
}
|
||||
|
||||
Slimefun.runSync(new AncientAltarTask(altars, b, b.getLocation().add(0.5, 1.3, 0.5), result, pedestals, consumed), 10L);
|
||||
Slimefun.runSync(new AncientAltarTask(b, result, pedestals, consumed), 10L);
|
||||
}
|
||||
else {
|
||||
altars.remove(b);
|
||||
@ -195,7 +207,7 @@ public class AncientAltarListener implements Listener {
|
||||
if (pedestal.getType() == Material.DISPENSER) {
|
||||
String id = BlockStorage.checkID(pedestal);
|
||||
|
||||
if (id != null && id.equals(PEDESTAL_ID)) {
|
||||
if (id != null && id.equals(SlimefunItems.ANCIENT_PEDESTAL.getItemID())) {
|
||||
SlimefunPlugin.getLocal().sendMessage(e.getPlayer(), "messages.cannot-place", true);
|
||||
e.setCancelled(true);
|
||||
}
|
||||
@ -247,29 +259,30 @@ public class AncientAltarListener implements Listener {
|
||||
|
||||
private List<Block> getPedestals(Block altar) {
|
||||
List<Block> list = new ArrayList<>();
|
||||
String id = SlimefunItems.ANCIENT_PEDESTAL.getItemID();
|
||||
|
||||
if (BlockStorage.check(altar.getRelative(2, 0, -2), PEDESTAL_ID)) {
|
||||
if (BlockStorage.check(altar.getRelative(2, 0, -2), id)) {
|
||||
list.add(altar.getRelative(2, 0, -2));
|
||||
}
|
||||
if (BlockStorage.check(altar.getRelative(3, 0, 0), PEDESTAL_ID)) {
|
||||
if (BlockStorage.check(altar.getRelative(3, 0, 0), id)) {
|
||||
list.add(altar.getRelative(3, 0, 0));
|
||||
}
|
||||
if (BlockStorage.check(altar.getRelative(2, 0, 2), PEDESTAL_ID)) {
|
||||
if (BlockStorage.check(altar.getRelative(2, 0, 2), id)) {
|
||||
list.add(altar.getRelative(2, 0, 2));
|
||||
}
|
||||
if (BlockStorage.check(altar.getRelative(0, 0, 3), PEDESTAL_ID)) {
|
||||
if (BlockStorage.check(altar.getRelative(0, 0, 3), id)) {
|
||||
list.add(altar.getRelative(0, 0, 3));
|
||||
}
|
||||
if (BlockStorage.check(altar.getRelative(-2, 0, 2), PEDESTAL_ID)) {
|
||||
if (BlockStorage.check(altar.getRelative(-2, 0, 2), id)) {
|
||||
list.add(altar.getRelative(-2, 0, 2));
|
||||
}
|
||||
if (BlockStorage.check(altar.getRelative(-3, 0, 0), PEDESTAL_ID)) {
|
||||
if (BlockStorage.check(altar.getRelative(-3, 0, 0), id)) {
|
||||
list.add(altar.getRelative(-3, 0, 0));
|
||||
}
|
||||
if (BlockStorage.check(altar.getRelative(-2, 0, -2), PEDESTAL_ID)) {
|
||||
if (BlockStorage.check(altar.getRelative(-2, 0, -2), id)) {
|
||||
list.add(altar.getRelative(-2, 0, -2));
|
||||
}
|
||||
if (BlockStorage.check(altar.getRelative(0, 0, -3), PEDESTAL_ID)) {
|
||||
if (BlockStorage.check(altar.getRelative(0, 0, -3), id)) {
|
||||
list.add(altar.getRelative(0, 0, -3));
|
||||
}
|
||||
|
||||
|
@ -13,8 +13,6 @@ import org.bukkit.Material;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.TileState;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -71,11 +69,8 @@ public class BlockListener implements Listener {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
else {
|
||||
BlockState state = e.getBlock().getState();
|
||||
boolean supportsPersistentData = state instanceof TileState;
|
||||
|
||||
if (supportsPersistentData) {
|
||||
SlimefunPlugin.getBlockDataService().setBlockData((TileState) state, sfItem.getID());
|
||||
if (SlimefunPlugin.getBlockDataService().isTileEntity(e.getBlock().getType())) {
|
||||
SlimefunPlugin.getBlockDataService().setBlockData(e.getBlock(), sfItem.getID());
|
||||
}
|
||||
|
||||
BlockStorage.addBlockInfo(e.getBlock(), "id", sfItem.getID(), true);
|
||||
@ -157,15 +152,11 @@ public class BlockListener implements Listener {
|
||||
if (sensitiveMaterials.contains(block2.getType())) {
|
||||
SlimefunItem sfItem = BlockStorage.check(e.getBlock().getRelative(BlockFace.UP));
|
||||
|
||||
if (sfItem == null) {
|
||||
BlockState state = block2.getState();
|
||||
if (sfItem == null && SlimefunPlugin.getBlockDataService().isTileEntity(block2.getType())) {
|
||||
Optional<String> blockData = SlimefunPlugin.getBlockDataService().getBlockData(block2);
|
||||
|
||||
if (state instanceof TileState) {
|
||||
Optional<String> blockData = SlimefunPlugin.getBlockDataService().getBlockData((TileState) state);
|
||||
|
||||
if (blockData.isPresent()) {
|
||||
sfItem = SlimefunItem.getByID(blockData.get());
|
||||
}
|
||||
if (blockData.isPresent()) {
|
||||
sfItem = SlimefunItem.getByID(blockData.get());
|
||||
}
|
||||
}
|
||||
|
||||
@ -189,15 +180,11 @@ public class BlockListener implements Listener {
|
||||
|
||||
SlimefunItem sfItem = BlockStorage.check(e.getBlock());
|
||||
|
||||
if (sfItem == null) {
|
||||
BlockState state = e.getBlock().getState();
|
||||
if (sfItem == null && SlimefunPlugin.getBlockDataService().isTileEntity(e.getBlock().getType())) {
|
||||
Optional<String> blockData = SlimefunPlugin.getBlockDataService().getBlockData(e.getBlock());
|
||||
|
||||
if (state instanceof TileState) {
|
||||
Optional<String> blockData = SlimefunPlugin.getBlockDataService().getBlockData((TileState) state);
|
||||
|
||||
if (blockData.isPresent()) {
|
||||
sfItem = SlimefunItem.getByID(blockData.get());
|
||||
}
|
||||
if (blockData.isPresent()) {
|
||||
sfItem = SlimefunItem.getByID(blockData.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,10 +3,12 @@ package io.github.thebusybiscuit.slimefun4.implementation.listeners;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.type.Piston;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.event.block.BlockPistonEvent;
|
||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
@ -16,6 +18,17 @@ import org.bukkit.inventory.ItemStack;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
|
||||
/**
|
||||
* This {@link Listener} is responsible for listening to any physics-based events, such
|
||||
* as {@link EntityChangeBlockEvent} or a {@link BlockPistonEvent}.
|
||||
*
|
||||
* This ensures that a {@link Piston} cannot be abused to break Slimefun blocks.
|
||||
*
|
||||
* @author VoidAngel
|
||||
* @author Poslovitch
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
*/
|
||||
public class BlockPhysicsListener implements Listener {
|
||||
|
||||
public BlockPhysicsListener(SlimefunPlugin plugin) {
|
||||
|
@ -17,9 +17,17 @@ import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.androids.AndroidInstance;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.androids.ButcherAndroid;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
/**
|
||||
* This {@link Listener} handles the collecton of drops from an {@link Entity} that was
|
||||
* killed by a {@link ButcherAndroid}.
|
||||
*
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
*/
|
||||
public class ButcherAndroidListener implements Listener {
|
||||
|
||||
public ButcherAndroidListener(SlimefunPlugin plugin) {
|
||||
|
@ -12,6 +12,13 @@ import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
|
||||
|
||||
/**
|
||||
* This {@link Listener} listens to the {@link EntityDeathEvent} to automatically
|
||||
* create a waypoint for a {@link Player} who carries an Emergency Transmitter.
|
||||
*
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
*/
|
||||
public class DeathpointListener implements Listener {
|
||||
|
||||
private final SimpleDateFormat format = new SimpleDateFormat("(MMM d, yyyy @ hh:mm)");
|
||||
|
@ -2,6 +2,7 @@ package io.github.thebusybiscuit.slimefun4.implementation.listeners;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.IronGolem;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
@ -12,6 +13,14 @@ import org.bukkit.inventory.PlayerInventory;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
|
||||
/**
|
||||
* This {@link Listener} makes sure that an {@link IronGolem} cannot be healed with
|
||||
* a {@link SlimefunItem}.
|
||||
* This fixes Issue 1332.
|
||||
*
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
*/
|
||||
public class IronGolemListener implements Listener {
|
||||
|
||||
public IronGolemListener(SlimefunPlugin plugin) {
|
||||
|
@ -10,6 +10,15 @@ import io.github.thebusybiscuit.slimefun4.core.attributes.WitherProof;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
|
||||
/**
|
||||
* This {@link Listener} is responsible for implementing the functionality of blocks that
|
||||
* were marked as {@link WitherProof} to not be destroyed by a {@link Wither}.
|
||||
*
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
* @see WitherProof
|
||||
*
|
||||
*/
|
||||
public class WitherListener implements Listener {
|
||||
|
||||
public WitherListener(SlimefunPlugin plugin) {
|
||||
|
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* This package contains all implementations of {@link io.github.thebusybiscuit.slimefun4.api.geo.GEOResource}.
|
||||
*/
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.resources;
|
@ -1396,7 +1396,7 @@ public final class SlimefunItemSetup {
|
||||
new String[] {"unplaceable-blocks"}, new Object[] {MaterialCollections.getAllUnbreakableBlocks().stream().map(Material::name).collect(Collectors.toList())})
|
||||
.register(plugin);
|
||||
|
||||
new TelepositionScroll(Categories.MAGIC, (SlimefunItemStack) SlimefunItems.SCROLL_OF_DIMENSIONAL_TELEPOSITION, RecipeType.MAGIC_WORKBENCH,
|
||||
new TelepositionScroll(Categories.MAGIC, SlimefunItems.SCROLL_OF_DIMENSIONAL_TELEPOSITION, RecipeType.MAGIC_WORKBENCH,
|
||||
new ItemStack[] {null, SlimefunItems.ENDER_LUMP_3, SlimefunItems.MAGIC_EYE_OF_ENDER, SlimefunItems.ENDER_LUMP_3, SlimefunItems.MAGICAL_BOOK_COVER, SlimefunItems.ENDER_LUMP_3, SlimefunItems.MAGIC_EYE_OF_ENDER, SlimefunItems.ENDER_LUMP_3, null})
|
||||
.register(plugin);
|
||||
|
||||
@ -1408,7 +1408,7 @@ public final class SlimefunItemSetup {
|
||||
new ItemStack[] {null, new ItemStack(Material.STICK), new ItemStack(Material.ICE), SlimefunItems.STAFF_WATER, null, new ItemStack(Material.PACKED_ICE), null, new ItemStack(Material.STICK), new ItemStack(Material.ICE)})
|
||||
.register(plugin);
|
||||
|
||||
new KnowledgeTome(Categories.MAGIC, (SlimefunItemStack) SlimefunItems.TOME_OF_KNOWLEDGE_SHARING, RecipeType.MAGIC_WORKBENCH,
|
||||
new KnowledgeTome(Categories.MAGIC, SlimefunItems.TOME_OF_KNOWLEDGE_SHARING, RecipeType.MAGIC_WORKBENCH,
|
||||
new ItemStack[] {null, new ItemStack(Material.FEATHER), null, new ItemStack(Material.INK_SAC), SlimefunItems.MAGICAL_BOOK_COVER, new ItemStack(Material.GLASS_BOTTLE), null, new ItemStack(Material.WRITABLE_BOOK), null})
|
||||
.register(plugin);
|
||||
|
||||
@ -1528,12 +1528,12 @@ public final class SlimefunItemSetup {
|
||||
new CustomItem(SlimefunItems.WITHER_PROOF_OBSIDIAN, 4))
|
||||
.register(plugin);
|
||||
|
||||
new AncientPedestal(Categories.LUMPS_AND_MAGIC, (SlimefunItemStack) SlimefunItems.ANCIENT_PEDESTAL, RecipeType.MAGIC_WORKBENCH,
|
||||
new AncientPedestal(Categories.LUMPS_AND_MAGIC, SlimefunItems.ANCIENT_PEDESTAL, RecipeType.MAGIC_WORKBENCH,
|
||||
new ItemStack[] {new ItemStack(Material.OBSIDIAN), SlimefunItems.GOLD_8K, new ItemStack(Material.OBSIDIAN), null, new ItemStack(Material.STONE), null, new ItemStack(Material.OBSIDIAN), SlimefunItems.GOLD_8K, new ItemStack(Material.OBSIDIAN)},
|
||||
new CustomItem(SlimefunItems.ANCIENT_PEDESTAL, 4))
|
||||
.register(plugin);
|
||||
|
||||
new SlimefunItem(Categories.MAGIC, (SlimefunItemStack) SlimefunItems.ANCIENT_ALTAR, RecipeType.MAGIC_WORKBENCH,
|
||||
new SlimefunItem(Categories.MAGIC, SlimefunItems.ANCIENT_ALTAR, RecipeType.MAGIC_WORKBENCH,
|
||||
new ItemStack[] {null, new ItemStack(Material.ENCHANTING_TABLE), null, SlimefunItems.MAGIC_LUMP_3, SlimefunItems.GOLD_8K, SlimefunItems.MAGIC_LUMP_3, new ItemStack(Material.OBSIDIAN), SlimefunItems.GOLD_8K, new ItemStack(Material.OBSIDIAN)})
|
||||
.register(plugin);
|
||||
|
||||
@ -2519,16 +2519,16 @@ public final class SlimefunItemSetup {
|
||||
new CustomItem(SlimefunItems.RUNE_ENDER, 6))
|
||||
.register(plugin);
|
||||
|
||||
new SlimefunItem(Categories.LUMPS_AND_MAGIC, (SlimefunItemStack) SlimefunItems.RUNE_LIGHTNING, RecipeType.ANCIENT_ALTAR,
|
||||
new SlimefunItem(Categories.LUMPS_AND_MAGIC, SlimefunItems.RUNE_LIGHTNING, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(Material.IRON_INGOT), SlimefunItems.MAGIC_LUMP_3, new ItemStack(Material.IRON_INGOT), SlimefunItems.RUNE_AIR, new ItemStack(Material.PHANTOM_MEMBRANE), SlimefunItems.RUNE_WATER, new ItemStack(Material.IRON_INGOT), SlimefunItems.MAGIC_LUMP_3, new ItemStack(Material.IRON_INGOT)},
|
||||
new CustomItem(SlimefunItems.RUNE_LIGHTNING, 4))
|
||||
.register(plugin);
|
||||
|
||||
new SlimefunItem(Categories.LUMPS_AND_MAGIC, (SlimefunItemStack) SlimefunItems.RUNE_RAINBOW, RecipeType.ANCIENT_ALTAR,
|
||||
new SlimefunItem(Categories.LUMPS_AND_MAGIC, SlimefunItems.RUNE_RAINBOW, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(Material.RED_DYE), SlimefunItems.MAGIC_LUMP_3, new ItemStack(Material.CYAN_DYE), new ItemStack(Material.WHITE_WOOL), SlimefunItems.RUNE_ENDER, new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.YELLOW_DYE), SlimefunItems.ENDER_LUMP_3, new ItemStack(Material.MAGENTA_DYE)})
|
||||
.register(plugin);
|
||||
|
||||
new SoulboundRune(Categories.LUMPS_AND_MAGIC, (SlimefunItemStack) SlimefunItems.RUNE_SOULBOUND, RecipeType.ANCIENT_ALTAR,
|
||||
new SoulboundRune(Categories.LUMPS_AND_MAGIC, SlimefunItems.RUNE_SOULBOUND, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {SlimefunItems.MAGIC_LUMP_3, SlimefunItems.ESSENCE_OF_AFTERLIFE, SlimefunItems.MAGIC_LUMP_3, SlimefunItems.ENDER_LUMP_3, SlimefunItems.RUNE_ENDER, SlimefunItems.ENDER_LUMP_3, SlimefunItems.MAGIC_LUMP_3, SlimefunItems.ESSENCE_OF_AFTERLIFE, SlimefunItems.MAGIC_LUMP_3})
|
||||
.register(plugin);
|
||||
|
||||
|
@ -15,14 +15,26 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.altar.AncientAltar;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.AncientAltarListener;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
/**
|
||||
* The {@link AncientAltarTask} is responsible for the animation that happens when a ritual
|
||||
* involving the {@link AncientAltar} is started.
|
||||
*
|
||||
* @author dniym
|
||||
* @author meiamsome
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
* @see AncientAltar
|
||||
* @see AncientAltarListener
|
||||
*
|
||||
*/
|
||||
public class AncientAltarTask implements Runnable {
|
||||
|
||||
private final AncientAltarListener listener = SlimefunPlugin.getAncientAltarListener();
|
||||
private final List<Block> altars;
|
||||
|
||||
private final Block altar;
|
||||
private final Location dropLocation;
|
||||
@ -36,10 +48,9 @@ public class AncientAltarTask implements Runnable {
|
||||
private boolean running;
|
||||
private int stage;
|
||||
|
||||
public AncientAltarTask(List<Block> altars, Block altar, Location drop, ItemStack output, List<Block> pedestals, List<ItemStack> items) {
|
||||
this.dropLocation = drop;
|
||||
public AncientAltarTask(Block altar, ItemStack output, List<Block> pedestals, List<ItemStack> items) {
|
||||
this.dropLocation = altar.getLocation().add(0.5, 1.3, 0.5);
|
||||
this.altar = altar;
|
||||
this.altars = altars;
|
||||
this.output = output;
|
||||
this.pedestals = pedestals;
|
||||
this.items = items;
|
||||
@ -124,7 +135,7 @@ public class AncientAltarTask implements Runnable {
|
||||
listener.getAltarsInUse().remove(altar.getLocation());
|
||||
dropLocation.getWorld().playSound(dropLocation, Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR, 1F, 1F);
|
||||
itemLock.clear();
|
||||
altars.remove(altar);
|
||||
listener.getAltars().remove(altar);
|
||||
}
|
||||
|
||||
private void finish() {
|
||||
@ -137,7 +148,7 @@ public class AncientAltarTask implements Runnable {
|
||||
|
||||
// This should re-enable altar blocks on craft completion.
|
||||
listener.getAltarsInUse().remove(altar.getLocation());
|
||||
altars.remove(altar);
|
||||
listener.getAltars().remove(altar);
|
||||
}
|
||||
else {
|
||||
dropLocation.getWorld().playSound(dropLocation, Sound.ENTITY_ZOMBIE_BREAK_WOODEN_DOOR, 1F, 1F);
|
||||
|
@ -30,7 +30,7 @@ public final class Categories {
|
||||
public static final Category TOOLS = new Category(new NamespacedKey(SlimefunPlugin.instance, "tools"), new CustomItem(SlimefunItems.AUTO_SMELT_PICKAXE, "&7Tools"), 1);
|
||||
public static final Category PORTABLE = new Category(new NamespacedKey(SlimefunPlugin.instance, "items"), new CustomItem(SlimefunItems.BACKPACK_MEDIUM, "&7Useful Items"), 1);
|
||||
public static final Category FOOD = new Category(new NamespacedKey(SlimefunPlugin.instance, "food"), new CustomItem(SlimefunItems.FORTUNE_COOKIE, "&7Food"), 2);
|
||||
public static final Category MACHINES_1 = new Category(new NamespacedKey(SlimefunPlugin.instance, "basic_machines"), new CustomItem(Material.SMITHING_TABLE, "&7Basic Machines"), 1);
|
||||
public static final Category MACHINES_1 = new Category(new NamespacedKey(SlimefunPlugin.instance, "basic_machines"), new CustomItem(Material.CRAFTING_TABLE, "&7Basic Machines"), 1);
|
||||
public static final Category ARMOR = new Category(new NamespacedKey(SlimefunPlugin.instance, "armor"), new CustomItem(SlimefunItems.DAMASCUS_STEEL_CHESTPLATE, "&7Armor"), 2);
|
||||
public static final Category LUMPS_AND_MAGIC = new Category(new NamespacedKey(SlimefunPlugin.instance, "magical_items"), new CustomItem(SlimefunItems.RUNE_ENDER, "&7Magical Items"), 2);
|
||||
public static final Category MAGIC = new Category(new NamespacedKey(SlimefunPlugin.instance, "magical_gadgets"), new CustomItem(SlimefunItems.INFUSED_ELYTRA, "&7Magical Gadgets"), 3);
|
||||
|
@ -358,14 +358,14 @@ public final class SlimefunItems {
|
||||
public static final ItemStack COOLING_UNIT = new SlimefunItemStack("COOLING_UNIT", "754bad86c99df780c889a1098f77648ead7385cc1ddb093da5a7d8c4c2ae54d", "&bCooling Unit");
|
||||
public static final ItemStack ELECTRIC_MOTOR = new SlimefunItemStack("ELECTRIC_MOTOR", "8cbca012f67e54de9aee72ff424e056c2ae58de5eacc949ab2bcd9683cec", "&cElectric Motor");
|
||||
public static final ItemStack CARGO_MOTOR = new SlimefunItemStack("CARGO_MOTOR", "8cbca012f67e54de9aee72ff424e056c2ae58de5eacc949ab2bcd9683cec", "&3Cargo Motor");
|
||||
public static final ItemStack SCROLL_OF_DIMENSIONAL_TELEPOSITION = new SlimefunItemStack("SCROLL_OF_DIMENSIONAL_TELEPOSITION", Material.PAPER, "&6Scroll of Dimensional Teleposition", "", "&cThis Scroll is capable of creating", "&ca temporary black Hole which pulls", "&cnearby Entities into itself and sends", "&cthem into another Dimension where", "&ceverything is turned around", "", "&rIn other words: Makes Entities turn by 180 Degrees");
|
||||
public static final ItemStack TOME_OF_KNOWLEDGE_SHARING = new SlimefunItemStack("TOME_OF_KNOWLEDGE_SHARING", Material.BOOK, "&6Tome of Knowledge Sharing", "&7Owner: &bNone", "", "&eRight Click&7 to bind this Tome to yourself", "", "", "&eRight Click&7 to obtain all Researches by", "&7the previously assigned Owner");
|
||||
public static final SlimefunItemStack SCROLL_OF_DIMENSIONAL_TELEPOSITION = new SlimefunItemStack("SCROLL_OF_DIMENSIONAL_TELEPOSITION", Material.PAPER, "&6Scroll of Dimensional Teleposition", "", "&cThis Scroll is capable of creating", "&ca temporary black Hole which pulls", "&cnearby Entities into itself and sends", "&cthem into another Dimension where", "&ceverything is turned around", "", "&rIn other words: Makes Entities turn by 180 Degrees");
|
||||
public static final SlimefunItemStack TOME_OF_KNOWLEDGE_SHARING = new SlimefunItemStack("TOME_OF_KNOWLEDGE_SHARING", Material.BOOK, "&6Tome of Knowledge Sharing", "&7Owner: &bNone", "", "&eRight Click&7 to bind this Tome to yourself", "", "", "&eRight Click&7 to obtain all Researches by", "&7the previously assigned Owner");
|
||||
public static final ItemStack HARDENED_GLASS = new SlimefunItemStack("HARDENED_GLASS", Material.LIGHT_GRAY_STAINED_GLASS, "&7Hardened Glass", "", "&rWithstands Explosions");
|
||||
public static final ItemStack WITHER_PROOF_OBSIDIAN = new SlimefunItemStack("WITHER_PROOF_OBSIDIAN", Material.OBSIDIAN, "&5Wither-Proof Obsidian", "", "&rWithstands Explosions", "&rWithstands Wither Bosses");
|
||||
public static final ItemStack WITHER_PROOF_GLASS = new SlimefunItemStack("WITHER_PROOF_GLASS", Material.PURPLE_STAINED_GLASS, "&5Wither-Proof Glass", "", "&rWithstands Explosions", "&rWithstands Wither Bosses");
|
||||
public static final ItemStack REINFORCED_PLATE = new SlimefunItemStack("REINFORCED_PLATE", Material.PAPER, "&7Reinforced Plate");
|
||||
public static final ItemStack ANCIENT_PEDESTAL = new SlimefunItemStack("ANCIENT_PEDESTAL", Material.DISPENSER, "&dAncient Pedestal", "", "&5Part of the Ancient Altar");
|
||||
public static final ItemStack ANCIENT_ALTAR = new SlimefunItemStack("ANCIENT_ALTAR", Material.ENCHANTING_TABLE, "&dAncient Altar", "", "&5Multi-Block Altar for", "&5magical Crafting Processes");
|
||||
public static final SlimefunItemStack ANCIENT_PEDESTAL = new SlimefunItemStack("ANCIENT_PEDESTAL", Material.DISPENSER, "&dAncient Pedestal", "", "&5Part of the Ancient Altar");
|
||||
public static final SlimefunItemStack ANCIENT_ALTAR = new SlimefunItemStack("ANCIENT_ALTAR", Material.ENCHANTING_TABLE, "&dAncient Altar", "", "&5Multi-Block Altar for", "&5magical Crafting Processes");
|
||||
public static final ItemStack COPPER_WIRE = new SlimefunItemStack("COPPER_WIRE", Material.STRING, "&6Copper Wire", "", "&6Crucial component in electric modules");
|
||||
|
||||
public static final SlimefunItemStack RAINBOW_WOOL = new SlimefunItemStack("RAINBOW_WOOL", Material.WHITE_WOOL, "&5Rainbow Wool", "", "&dCycles through all Colors of the Rainbow!");
|
||||
@ -581,9 +581,9 @@ public final class SlimefunItems {
|
||||
public static final ItemStack RUNE_EARTH = new SlimefunItemStack("ANCIENT_RUNE_EARTH", new ColoredFireworkStar(Color.fromRGB(112, 47, 7), "&7Ancient Rune &8&l[&c&lEarth&8&l]"));
|
||||
public static final ItemStack RUNE_ENDER = new SlimefunItemStack("ANCIENT_RUNE_ENDER", new ColoredFireworkStar(Color.PURPLE, "&7Ancient Rune &8&l[&5&lEnder&8&l]"));
|
||||
|
||||
public static final ItemStack RUNE_RAINBOW = new SlimefunItemStack("ANCIENT_RUNE_RAINBOW", new ColoredFireworkStar(Color.FUCHSIA, "&7Ancient Rune &8&l[&d&lRainbow&8&l]"));
|
||||
public static final ItemStack RUNE_LIGHTNING = new SlimefunItemStack("ANCIENT_RUNE_LIGHTNING", new ColoredFireworkStar(Color.fromRGB(255, 255, 95), "&7Ancient Rune &8&l[&e&lLightning&8&l]"));
|
||||
public static final ItemStack RUNE_SOULBOUND = new SlimefunItemStack("ANCIENT_RUNE_SOULBOUND", new ColoredFireworkStar(Color.fromRGB(47, 0, 117), "&7Ancient Rune &8&l[&5&lSoulbound&8&l]", "&eDrop this rune onto a dropped item to", "&5bind ðat item to your soul.", " ", "&eIt is advised that you only use this rune", "&eon &6important &eitems.", " ", "&eItems bound to your soul won't drop on death."));
|
||||
public static final SlimefunItemStack RUNE_RAINBOW = new SlimefunItemStack("ANCIENT_RUNE_RAINBOW", new ColoredFireworkStar(Color.FUCHSIA, "&7Ancient Rune &8&l[&d&lRainbow&8&l]"));
|
||||
public static final SlimefunItemStack RUNE_LIGHTNING = new SlimefunItemStack("ANCIENT_RUNE_LIGHTNING", new ColoredFireworkStar(Color.fromRGB(255, 255, 95), "&7Ancient Rune &8&l[&e&lLightning&8&l]"));
|
||||
public static final SlimefunItemStack RUNE_SOULBOUND = new SlimefunItemStack("ANCIENT_RUNE_SOULBOUND", new ColoredFireworkStar(Color.fromRGB(47, 0, 117), "&7Ancient Rune &8&l[&5&lSoulbound&8&l]", "&eDrop this rune onto a dropped item to", "&5bind ðat item to your soul.", " ", "&eIt is advised that you only use this rune", "&eon &6important &eitems.", " ", "&eItems bound to your soul won't drop on death."));
|
||||
|
||||
/* Electricity */
|
||||
public static final ItemStack SOLAR_GENERATOR = new SlimefunItemStack("SOLAR_GENERATOR", Material.DAYLIGHT_DETECTOR, "&bSolar Generator", "", LoreBuilder.machine(MachineTier.BASIC, MachineType.GENERATOR), LoreBuilder.powerBuffer(0), LoreBuilder.powerPerSecond(4));
|
||||
|
@ -22,10 +22,8 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
/**
|
||||
* Statically handles categories.
|
||||
* Represents a category, which structure multiple {@link SlimefunItem} in the guide.
|
||||
* <p>
|
||||
* See {@link Categories} for the built-in categories.
|
||||
* Represents a category, which structure multiple {@link SlimefunItem} in the {@link SlimefunGuide}.
|
||||
* See {@link Categories} for all built-in categories.
|
||||
*
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
|
@ -108,12 +108,10 @@ public class LockedCategory extends Category {
|
||||
*
|
||||
* @param p
|
||||
* The {@link Player} to check
|
||||
* @param profile
|
||||
* The {@link PlayerProfile} that belongs to the given {@link Player}
|
||||
* @return Whether the {@link Player} has fully completed all parent categories, otherwise false
|
||||
*/
|
||||
public boolean hasUnlocked(Player p) {
|
||||
return hasUnlocked(p, PlayerProfile.get(p));
|
||||
}
|
||||
|
||||
public boolean hasUnlocked(Player p, PlayerProfile profile) {
|
||||
for (Category category : parents) {
|
||||
for (SlimefunItem item : category.getItems()) {
|
||||
|
@ -11,7 +11,6 @@ import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.data.PersistentDataAPI;
|
||||
import io.github.thebusybiscuit.slimefun4.api.events.ResearchUnlockEvent;
|
||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideSettings;
|
||||
@ -23,8 +22,8 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
/**
|
||||
* Statically handles researches. Represents a research, which is bound to one
|
||||
* {@link SlimefunItem} or more and require XP levels to unlock this/these item(s).
|
||||
* Represents a research, which is bound to one
|
||||
* {@link SlimefunItem} or more and requires XP levels to unlock said item(s).
|
||||
*
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
@ -161,8 +160,12 @@ public class Research implements Keyed {
|
||||
* @return Whether that {@link Player} can unlock this {@link Research}
|
||||
*/
|
||||
public boolean canUnlock(Player p) {
|
||||
if (!isEnabled()) return true;
|
||||
return (p.getGameMode() == GameMode.CREATIVE && SlimefunPlugin.getRegistry().isFreeCreativeResearchingEnabled()) || p.getLevel() >= this.cost;
|
||||
if (!isEnabled()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean creativeResearch = p.getGameMode() == GameMode.CREATIVE && SlimefunPlugin.getRegistry().isFreeCreativeResearchingEnabled();
|
||||
return creativeResearch || p.getLevel() >= this.cost;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -187,7 +190,7 @@ public class Research implements Keyed {
|
||||
profile.setResearched(this, true);
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "messages.unlocked", true, msg -> msg.replace("%research%", getName(p)));
|
||||
|
||||
if (SlimefunPlugin.getRegistry().isResearchFireworkEnabled() && (!PersistentDataAPI.hasByte(p, SlimefunGuideSettings.FIREWORKS_KEY) || PersistentDataAPI.getByte(p, SlimefunGuideSettings.FIREWORKS_KEY) == (byte) 1)) {
|
||||
if (SlimefunPlugin.getRegistry().isResearchFireworkEnabled() && SlimefunGuideSettings.hasFireworksEnabled(p)) {
|
||||
FireworkUtils.launchRandom(p, 1);
|
||||
}
|
||||
};
|
||||
@ -202,15 +205,7 @@ public class Research implements Keyed {
|
||||
}
|
||||
else if (SlimefunPlugin.getRegistry().getCurrentlyResearchingPlayers().add(p.getUniqueId())) {
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "messages.research.start", true, msg -> msg.replace("%research%", getName(p)));
|
||||
|
||||
for (int i = 1; i < RESEARCH_PROGRESS.length + 1; i++) {
|
||||
int j = i;
|
||||
|
||||
Slimefun.runSync(() -> {
|
||||
p.playSound(p.getLocation(), Sound.ENTITY_BAT_TAKEOFF, 0.7F, 1F);
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "messages.research.progress", true, msg -> msg.replace("%research%", getName(p)).replace("%progress%", RESEARCH_PROGRESS[j - 1] + "%"));
|
||||
}, i * 20L);
|
||||
}
|
||||
playResearchAnimation(p);
|
||||
|
||||
Slimefun.runSync(() -> {
|
||||
runnable.run();
|
||||
@ -223,6 +218,17 @@ public class Research implements Keyed {
|
||||
});
|
||||
}
|
||||
|
||||
private void playResearchAnimation(Player p) {
|
||||
for (int i = 1; i < RESEARCH_PROGRESS.length + 1; i++) {
|
||||
int j = i;
|
||||
|
||||
Slimefun.runSync(() -> {
|
||||
p.playSound(p.getLocation(), Sound.ENTITY_BAT_TAKEOFF, 0.7F, 1F);
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "messages.research.progress", true, msg -> msg.replace("%research%", getName(p)).replace("%progress%", RESEARCH_PROGRESS[j - 1] + "%"));
|
||||
}, i * 20L);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers this {@link Research}.
|
||||
*/
|
||||
|
@ -27,6 +27,8 @@ import io.github.thebusybiscuit.slimefun4.core.attributes.Radioactive;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.WitherProof;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.VanillaItem;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.AutoDisenchanter;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.AutoEnchanter;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.tools.SlimefunBackpack;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
@ -60,18 +62,44 @@ public class SlimefunItem implements Placeable {
|
||||
|
||||
private String[] keys;
|
||||
private Object[] values;
|
||||
private String wiki = null;
|
||||
|
||||
private Optional<String> wikiLink = Optional.empty();
|
||||
private final OptionalMap<Class<? extends ItemHandler>, ItemHandler> itemhandlers = new OptionalMap<>(HashMap::new);
|
||||
|
||||
private boolean ticking = false;
|
||||
private BlockTicker blockTicker;
|
||||
private GeneratorTicker energyTicker;
|
||||
|
||||
/**
|
||||
* This creates a new {@link SlimefunItem} from the given arguments.
|
||||
*
|
||||
* @param category
|
||||
* The {@link Category} this {@link SlimefunItem} belongs to
|
||||
* @param item
|
||||
* The {@link SlimefunItemStack} that describes the visual features of our {@link SlimefunItem}
|
||||
* @param recipeType
|
||||
* the {@link RecipeType} that determines how this {@link SlimefunItem} is crafted
|
||||
* @param recipe
|
||||
* An Array representing the recipe of this {@link SlimefunItem}
|
||||
*/
|
||||
public SlimefunItem(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||
this(category, item, recipeType, recipe, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* This creates a new {@link SlimefunItem} from the given arguments.
|
||||
*
|
||||
* @param category
|
||||
* The {@link Category} this {@link SlimefunItem} belongs to
|
||||
* @param item
|
||||
* The {@link SlimefunItemStack} that describes the visual features of our {@link SlimefunItem}
|
||||
* @param recipeType
|
||||
* the {@link RecipeType} that determines how this {@link SlimefunItem} is crafted
|
||||
* @param recipe
|
||||
* An Array representing the recipe of this {@link SlimefunItem}
|
||||
* @param recipeOutput
|
||||
* The result of crafting this item
|
||||
*/
|
||||
public SlimefunItem(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, ItemStack recipeOutput) {
|
||||
this(category, item, recipeType, recipe, recipeOutput, null, null);
|
||||
}
|
||||
@ -80,7 +108,6 @@ public class SlimefunItem implements Placeable {
|
||||
this(category, item, recipeType, recipe, null, keys, values);
|
||||
}
|
||||
|
||||
// Root constructor
|
||||
public SlimefunItem(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, ItemStack recipeOutput, String[] keys, Object[] values) {
|
||||
Validate.notNull(category, "'category' is not allowed to be null!");
|
||||
Validate.notNull(item, "'item' is not allowed to be null!");
|
||||
@ -162,10 +189,22 @@ public class SlimefunItem implements Placeable {
|
||||
return research;
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns whether or not this {@link SlimefunItem} is allowed to be used in
|
||||
* an {@link AutoEnchanter}.
|
||||
*
|
||||
* @return Whether this {@link SlimefunItem} can be enchanted.
|
||||
*/
|
||||
public boolean isEnchantable() {
|
||||
return enchantable;
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns whether or not this {@link SlimefunItem} is allowed to be used in
|
||||
* an {@link AutoDisenchanter}.
|
||||
*
|
||||
* @return Whether this {@link SlimefunItem} can be disenchanted.
|
||||
*/
|
||||
public boolean isDisenchantable() {
|
||||
return disenchantable;
|
||||
}
|
||||
@ -488,18 +527,8 @@ public class SlimefunItem implements Placeable {
|
||||
* The associated wiki page
|
||||
*/
|
||||
public void addOficialWikipage(String page) {
|
||||
wiki = "https://github.com/TheBusyBiscuit/Slimefun4/wiki/" + page;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns whether this item has been assigned a wiki page.
|
||||
*
|
||||
* @see SlimefunItem#addOficialWikipage(String)
|
||||
*
|
||||
* @return Whether this Item has a wiki page
|
||||
*/
|
||||
public boolean hasWikipage() {
|
||||
return wiki != null;
|
||||
Validate.notNull(page, "Wiki page cannot be null.");
|
||||
wikiLink = Optional.of("https://github.com/TheBusyBiscuit/Slimefun4/wiki/" + page);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -510,8 +539,8 @@ public class SlimefunItem implements Placeable {
|
||||
*
|
||||
* @return This item's wiki page
|
||||
*/
|
||||
public String getWikipage() {
|
||||
return wiki;
|
||||
public Optional<String> getWikipage() {
|
||||
return wikiLink;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -9,7 +9,7 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
* Implement this interface for any {@link SlimefunItem} to prevent
|
||||
* that {@link SlimefunItem} from being placed.
|
||||
*
|
||||
* Important: This will not cancel any {@link BlockPlaceEvent}.
|
||||
* <b>Important</b>: This will not cancel any {@link BlockPlaceEvent}.
|
||||
* It will simply prevent Slimefun from ever registering this {@link SlimefunItem}
|
||||
* as a placed {@link Block}.
|
||||
*
|
||||
|
@ -1,7 +1,10 @@
|
||||
package me.mrCookieSlime.Slimefun;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
@ -15,6 +18,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
import io.github.thebusybiscuit.cscorelib2.config.Config;
|
||||
import io.github.thebusybiscuit.cscorelib2.protection.ProtectionManager;
|
||||
import io.github.thebusybiscuit.cscorelib2.reflection.ReflectionUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
|
||||
import io.github.thebusybiscuit.slimefun4.api.gps.GPSNetwork;
|
||||
import io.github.thebusybiscuit.slimefun4.api.network.NetworkManager;
|
||||
@ -372,7 +376,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
|
||||
getLogger().log(Level.SEVERE, "###");
|
||||
getLogger().log(Level.SEVERE, "### You are using Minecraft {0}", ReflectionUtils.getVersion());
|
||||
getLogger().log(Level.SEVERE, "### but Slimefun v{0} requires you to be using", getDescription().getVersion());
|
||||
getLogger().log(Level.SEVERE, "### Minecraft {0}", String.join(" / ", MinecraftVersion.getSupportedVersions()));
|
||||
getLogger().log(Level.SEVERE, "### Minecraft {0}", String.join(" / ", getSupportedVersions()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -380,6 +384,18 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
|
||||
return false;
|
||||
}
|
||||
|
||||
private Collection<String> getSupportedVersions() {
|
||||
List<String> list = new ArrayList<>();
|
||||
|
||||
for (MinecraftVersion version : MinecraftVersion.values()) {
|
||||
if (version != MinecraftVersion.UNKNOWN) {
|
||||
list.add(version.getName());
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
// Slimefun never loaded successfully, so we don't even bother doing stuff here
|
||||
|
@ -19,7 +19,6 @@ import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.TileState;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
@ -567,8 +566,8 @@ public class BlockStorage {
|
||||
}
|
||||
|
||||
public static String checkID(Block b) {
|
||||
if (b.getState() instanceof TileState) {
|
||||
Optional<String> blockData = SlimefunPlugin.getBlockDataService().getBlockData((TileState) b.getState());
|
||||
if (SlimefunPlugin.getBlockDataService().isTileEntity(b.getType())) {
|
||||
Optional<String> blockData = SlimefunPlugin.getBlockDataService().getBlockData(b);
|
||||
|
||||
if (blockData.isPresent()) return blockData.get();
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ website: https://github.com/TheBusyBiscuit/Slimefun4
|
||||
main: me.mrCookieSlime.Slimefun.SlimefunPlugin
|
||||
softdepend: [CS-CoreLib, PlaceholderAPI]
|
||||
|
||||
api-version: 1.14
|
||||
api-version: 1.13
|
||||
|
||||
commands:
|
||||
slimefun:
|
||||
|
Loading…
Reference in New Issue
Block a user