Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -49,7 +49,7 @@ allprojects {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly 'com.willfp:eco:5.0.0'
|
||||
compileOnly 'com.willfp:eco:5.1.0'
|
||||
|
||||
compileOnly 'org.jetbrains:annotations:19.0.0'
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.willfp.eco.core.command.AbstractTabCompleter;
|
||||
import com.willfp.eco.util.NumberUtils;
|
||||
import com.willfp.ecoenchants.command.tabcompleters.TabCompleterRandomEnchant;
|
||||
import com.willfp.ecoenchants.display.EnchantmentCache;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -15,7 +16,9 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class CommandGiverandombook extends AbstractCommand {
|
||||
/**
|
||||
@@ -48,7 +51,13 @@ public class CommandGiverandombook extends AbstractCommand {
|
||||
|
||||
ItemStack itemStack = new ItemStack(Material.ENCHANTED_BOOK);
|
||||
EnchantmentStorageMeta meta = (EnchantmentStorageMeta) itemStack.getItemMeta();
|
||||
Enchantment enchantment = Enchantment.values()[NumberUtils.randInt(0, Enchantment.values().length - 1)];
|
||||
List<Enchantment> allowed = Arrays.stream(Enchantment.values()).filter(enchantment -> {
|
||||
if (enchantment instanceof EcoEnchant) {
|
||||
return ((EcoEnchant) enchantment).isEnabled();
|
||||
}
|
||||
return true;
|
||||
}).collect(Collectors.toList());
|
||||
Enchantment enchantment = allowed.get(NumberUtils.randInt(0, allowed.size() - 1));
|
||||
int level = NumberUtils.randInt(1, enchantment.getMaxLevel());
|
||||
meta.addStoredEnchant(enchantment, level, true);
|
||||
itemStack.setItemMeta(meta);
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.willfp.ecoenchants.enchantments.support.merging.grindstone;
|
||||
import com.willfp.eco.core.EcoPlugin;
|
||||
import com.willfp.eco.core.PluginDependent;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@@ -70,10 +72,15 @@ public class GrindstoneListeners extends PluginDependent implements Listener {
|
||||
newOut.setItemMeta(meta);
|
||||
}
|
||||
|
||||
final ItemStack finalOut = newOut;
|
||||
|
||||
this.getPlugin().getScheduler().run(() -> {
|
||||
inventory.setItem(2, finalOut);
|
||||
inventory.setItem(2, newOut);
|
||||
if (!toKeep.isEmpty()) {
|
||||
for (Entity entity : player.getNearbyEntities(10, 10, 10)) {
|
||||
if (entity.getType() == EntityType.EXPERIENCE_ORB) {
|
||||
entity.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 1);
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
version = 7.2.5
|
||||
version = 7.2.7
|
||||
plugin-name = EcoEnchants
|
||||
Reference in New Issue
Block a user