mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Removed EmeraldEnchants integration
This commit is contained in:
parent
876fbda585
commit
354dd30e52
@ -47,6 +47,7 @@
|
||||
* Improved performance for radioactive items
|
||||
* Memory/GC improvements for the profiler
|
||||
* Performance improvements for the Fluid Pump
|
||||
* Removed EmeraldEnchants integration
|
||||
|
||||
#### Fixes
|
||||
* Fixed #2448
|
||||
|
6
pom.xml
6
pom.xml
@ -414,12 +414,6 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.TheBusyBiscuit</groupId>
|
||||
<artifactId>EmeraldEnchants2</artifactId>
|
||||
<version>3cd370b5d8</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.minebuilders</groupId>
|
||||
<artifactId>clearlag-core</artifactId>
|
||||
|
@ -1,39 +0,0 @@
|
||||
package io.github.thebusybiscuit.slimefun4.core.services.plugins;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||
import io.github.thebusybiscuit.slimefun4.core.categories.FlexCategory;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideLayout;
|
||||
import me.mrCookieSlime.EmeraldEnchants.EnchantmentGuide;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
|
||||
/**
|
||||
* This is the EmeraldEnchants {@link Category}
|
||||
*
|
||||
* @deprecated Support for EmeraldEnchants is being faded out
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
class EmeraldEnchantsCategory extends FlexCategory {
|
||||
|
||||
public EmeraldEnchantsCategory(@Nonnull NamespacedKey key) {
|
||||
super(key, new CustomItem(Material.ENCHANTED_BOOK, "&2EmeraldEnchants &a(Enchantment Guide)"), 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open(Player p, PlayerProfile profile, SlimefunGuideLayout layout) {
|
||||
EnchantmentGuide.open(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible(Player p, PlayerProfile profile, SlimefunGuideLayout layout) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -7,7 +7,6 @@ import java.util.logging.Level;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -16,7 +15,6 @@ import org.bukkit.plugin.Plugin;
|
||||
import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
|
||||
import io.github.thebusybiscuit.slimefun4.core.categories.FlexCategory;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
@ -38,7 +36,6 @@ public class ThirdPartyPluginService {
|
||||
private boolean initialized = false;
|
||||
private boolean isExoticGardenInstalled = false;
|
||||
private boolean isChestTerminalInstalled = false;
|
||||
private boolean isEmeraldEnchantsInstalled = false;
|
||||
private boolean isMcMMOInstalled = false;
|
||||
|
||||
/**
|
||||
@ -78,13 +75,6 @@ public class ThirdPartyPluginService {
|
||||
}
|
||||
}
|
||||
|
||||
if (isPluginInstalled("EmeraldEnchants")) {
|
||||
isEmeraldEnchantsInstalled = true;
|
||||
Plugin emeraldEnchants = plugin.getServer().getPluginManager().getPlugin("EmeraldEnchants");
|
||||
FlexCategory category = new EmeraldEnchantsCategory(new NamespacedKey(emeraldEnchants, "enchantment_guide"));
|
||||
category.register();
|
||||
}
|
||||
|
||||
// WorldEdit Hook to clear Slimefun Data upon //set 0 //cut or any other equivalent
|
||||
if (isPluginInstalled("WorldEdit")) {
|
||||
try {
|
||||
@ -149,10 +139,6 @@ public class ThirdPartyPluginService {
|
||||
return isChestTerminalInstalled;
|
||||
}
|
||||
|
||||
public boolean isEmeraldEnchantsInstalled() {
|
||||
return isEmeraldEnchantsInstalled;
|
||||
}
|
||||
|
||||
public Optional<ItemStack> harvestExoticGardenPlant(Block block) {
|
||||
return exoticGardenIntegration.apply(block);
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public abstract class AbstractEnergyProvider extends SlimefunItem implements Inv
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public Set<MachineFuel> getFuelTypes2() {
|
||||
public Set<MachineFuel> getFuelTypes() {
|
||||
return fuelTypes;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -23,6 +25,7 @@ public abstract class AbstractGrowthAccelerator extends SlimefunItem implements
|
||||
|
||||
private static final int[] BORDER = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 };
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
public AbstractGrowthAccelerator(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||
super(category, item, recipeType, recipe);
|
||||
|
||||
|
@ -1,9 +1,7 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@ -17,9 +15,6 @@ import org.bukkit.inventory.meta.Repairable;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.inventory.InvUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.api.events.AutoDisenchantEvent;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.EmeraldEnchants.EmeraldEnchants;
|
||||
import me.mrCookieSlime.EmeraldEnchants.ItemEnchantment;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
@ -54,7 +49,6 @@ public class AutoDisenchanter extends AContainer {
|
||||
@Override
|
||||
protected MachineRecipe findNextRecipe(BlockMenu menu) {
|
||||
Map<Enchantment, Integer> enchantments = new HashMap<>();
|
||||
Set<ItemEnchantment> emeraldEnchantments = new HashSet<>();
|
||||
|
||||
for (int slot : getInputSlots()) {
|
||||
ItemStack item = menu.getItemInSlot(slot);
|
||||
@ -81,13 +75,6 @@ public class AutoDisenchanter extends AContainer {
|
||||
amount++;
|
||||
}
|
||||
|
||||
if (SlimefunPlugin.getThirdPartySupportService().isEmeraldEnchantsInstalled()) {
|
||||
for (ItemEnchantment enchantment : EmeraldEnchants.getInstance().getRegistry().getEnchantments(item)) {
|
||||
amount++;
|
||||
emeraldEnchantments.add(enchantment);
|
||||
}
|
||||
}
|
||||
|
||||
if (amount > 0) {
|
||||
ItemStack disenchantedItem = item.clone();
|
||||
disenchantedItem.setAmount(1);
|
||||
@ -95,11 +82,6 @@ public class AutoDisenchanter extends AContainer {
|
||||
ItemStack book = new ItemStack(Material.ENCHANTED_BOOK);
|
||||
transferEnchantments(disenchantedItem, book, enchantments);
|
||||
|
||||
for (ItemEnchantment ench : emeraldEnchantments) {
|
||||
EmeraldEnchants.getInstance().getRegistry().applyEnchantment(book, ench.getEnchantment(), ench.getLevel());
|
||||
EmeraldEnchants.getInstance().getRegistry().applyEnchantment(disenchantedItem, ench.getEnchantment(), 0);
|
||||
}
|
||||
|
||||
MachineRecipe recipe = new MachineRecipe(90 * amount / this.getSpeed(), new ItemStack[] { target, item }, new ItemStack[] { disenchantedItem, book });
|
||||
|
||||
if (!InvUtils.fitAll(menu.toInventory(), recipe.getOutput(), getOutputSlots())) {
|
||||
|
@ -1,9 +1,9 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
@ -11,9 +11,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.inventory.InvUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.EmeraldEnchants.EmeraldEnchants;
|
||||
import me.mrCookieSlime.EmeraldEnchants.ItemEnchantment;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
@ -24,12 +21,9 @@ import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
|
||||
|
||||
public class AutoEnchanter extends AContainer {
|
||||
|
||||
private final int emeraldEnchantsLimit;
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
public AutoEnchanter(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||
super(category, item, recipeType, recipe);
|
||||
|
||||
emeraldEnchantsLimit = SlimefunPlugin.getCfg().getInt("options.emerald-enchantment-limit");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -51,9 +45,7 @@ public class AutoEnchanter extends AContainer {
|
||||
|
||||
if (item != null && item.getType() == Material.ENCHANTED_BOOK && target != null) {
|
||||
Map<Enchantment, Integer> enchantments = new HashMap<>();
|
||||
Set<ItemEnchantment> emeraldEnchantments = new HashSet<>();
|
||||
int amount = 0;
|
||||
int specialAmount = 0;
|
||||
EnchantmentStorageMeta meta = (EnchantmentStorageMeta) item.getItemMeta();
|
||||
|
||||
for (Map.Entry<Enchantment, Integer> e : meta.getStoredEnchants().entrySet()) {
|
||||
@ -63,19 +55,7 @@ public class AutoEnchanter extends AContainer {
|
||||
}
|
||||
}
|
||||
|
||||
if (SlimefunPlugin.getThirdPartySupportService().isEmeraldEnchantsInstalled()) {
|
||||
for (ItemEnchantment enchantment : EmeraldEnchants.getInstance().getRegistry().getEnchantments(item)) {
|
||||
if (EmeraldEnchants.getInstance().getRegistry().isApplicable(target, enchantment.getEnchantment()) && EmeraldEnchants.getInstance().getRegistry().getEnchantmentLevel(target, enchantment.getEnchantment().getName()) < enchantment.getLevel()) {
|
||||
amount++;
|
||||
specialAmount++;
|
||||
emeraldEnchantments.add(enchantment);
|
||||
}
|
||||
}
|
||||
|
||||
specialAmount += EmeraldEnchants.getInstance().getRegistry().getEnchantments(target).size();
|
||||
}
|
||||
|
||||
if (amount > 0 && specialAmount <= emeraldEnchantsLimit) {
|
||||
if (amount > 0) {
|
||||
ItemStack enchantedItem = target.clone();
|
||||
enchantedItem.setAmount(1);
|
||||
|
||||
@ -83,10 +63,6 @@ public class AutoEnchanter extends AContainer {
|
||||
enchantedItem.addUnsafeEnchantment(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
for (ItemEnchantment ench : emeraldEnchantments) {
|
||||
EmeraldEnchants.getInstance().getRegistry().applyEnchantment(enchantedItem, ench.getEnchantment(), ench.getLevel());
|
||||
}
|
||||
|
||||
MachineRecipe recipe = new MachineRecipe(75 * amount / this.getSpeed(), new ItemStack[] { target, item }, new ItemStack[] { enchantedItem, new ItemStack(Material.BOOK) });
|
||||
|
||||
if (!InvUtils.fitAll(menu.toInventory(), recipe.getOutput(), getOutputSlots())) {
|
||||
|
@ -63,11 +63,4 @@ public class IronGolemListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
// @EventHandler
|
||||
// public void onIronGolemSpawn(PLEASE_GIMME_AN_EVENT e) {
|
||||
// if (e.getBlock().getType() == Material.IRON_BLOCK) {
|
||||
// e.setCancelled(true);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
@ -32,8 +32,6 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.altar.AncientPedestal;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.tasks.CapacitorTextureUpdateTask;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper;
|
||||
import me.mrCookieSlime.EmeraldEnchants.EmeraldEnchants;
|
||||
import me.mrCookieSlime.EmeraldEnchants.ItemEnchantment;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
|
||||
@ -98,15 +96,6 @@ public final class SlimefunUtils {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (SlimefunPlugin.getThirdPartySupportService().isEmeraldEnchantsInstalled()) {
|
||||
// We wanna operate on a copy now
|
||||
item = item.clone();
|
||||
|
||||
for (ItemEnchantment enchantment : EmeraldEnchants.getInstance().getRegistry().getEnchantments(item)) {
|
||||
EmeraldEnchants.getInstance().getRegistry().applyEnchantment(item, enchantment.getEnchantment(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
SlimefunItem sfItem = SlimefunItem.getByItem(item);
|
||||
|
||||
if (sfItem instanceof Soulbound) {
|
||||
|
@ -10,7 +10,6 @@ options:
|
||||
armor-update-interval: 10
|
||||
enable-armor-effects: true
|
||||
auto-save-delay-in-minutes: 10
|
||||
emerald-enchantment-limit: 2
|
||||
legacy-ore-washer: false
|
||||
legacy-dust-washer: false
|
||||
legacy-ore-grinder: true
|
||||
|
Loading…
Reference in New Issue
Block a user