mirror of
https://github.com/nulli0n/ExcellentEnchants-spigot.git
synced 2024-11-22 11:35:18 +01:00
v3.4.5
This commit is contained in:
parent
74c0ce9666
commit
c534fa7caa
22
Core/pom.xml
22
Core/pom.xml
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>ExcellentEnchants</artifactId>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<version>3.4.3</version>
|
||||
<version>3.4.5</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -95,37 +95,27 @@
|
||||
<dependency>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<artifactId>NMS</artifactId>
|
||||
<version>3.4.3</version>
|
||||
<version>3.4.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<artifactId>V1_17_R1</artifactId>
|
||||
<version>3.4.3</version>
|
||||
<version>3.4.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<artifactId>V1_18_R2</artifactId>
|
||||
<version>3.4.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<artifactId>V1_19_R1</artifactId>
|
||||
<version>3.4.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<artifactId>V1_19_R2</artifactId>
|
||||
<version>3.4.3</version>
|
||||
<version>3.4.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<artifactId>V1_19_R3</artifactId>
|
||||
<version>3.4.3</version>
|
||||
<version>3.4.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<artifactId>V1_20_R1</artifactId>
|
||||
<version>3.4.3</version>
|
||||
<version>3.4.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
@ -5,7 +5,7 @@ import su.nexmedia.engine.NexPlugin;
|
||||
import su.nexmedia.engine.Version;
|
||||
import su.nexmedia.engine.api.command.GeneralCommand;
|
||||
import su.nexmedia.engine.command.list.ReloadSubCommand;
|
||||
import su.nexmedia.engine.hooks.Hooks;
|
||||
import su.nexmedia.engine.utils.EngineUtils;
|
||||
import su.nightexpress.excellentenchants.command.BookCommand;
|
||||
import su.nightexpress.excellentenchants.command.EnchantCommand;
|
||||
import su.nightexpress.excellentenchants.command.ListCommand;
|
||||
@ -21,8 +21,6 @@ import su.nightexpress.excellentenchants.hook.impl.ProtocolHook;
|
||||
import su.nightexpress.excellentenchants.nms.EnchantNMS;
|
||||
import su.nightexpress.excellentenchants.nms.v1_17_R1.V1_17_R1;
|
||||
import su.nightexpress.excellentenchants.nms.v1_18_R2.V1_18_R2;
|
||||
import su.nightexpress.excellentenchants.nms.v1_19_R1.V1_19_R1;
|
||||
import su.nightexpress.excellentenchants.nms.v1_19_R2.V1_19_R2;
|
||||
import su.nightexpress.excellentenchants.nms.v1_19_R3.V1_19_R3;
|
||||
import su.nightexpress.excellentenchants.nms.v1_20_R1.V1_20_R1;
|
||||
import su.nightexpress.excellentenchants.tier.TierManager;
|
||||
@ -74,13 +72,12 @@ public class ExcellentEnchants extends NexPlugin<ExcellentEnchants> {
|
||||
}
|
||||
|
||||
private void setNMS() {
|
||||
this.enchantNMS = switch (Version.CURRENT) {
|
||||
this.enchantNMS = switch (Version.getCurrent()) {
|
||||
case V1_17_R1 -> new V1_17_R1();
|
||||
case V1_18_R2 -> new V1_18_R2();
|
||||
case V1_19_R1 -> new V1_19_R1();
|
||||
case V1_19_R2 -> new V1_19_R2();
|
||||
case V1_19_R3 -> new V1_19_R3();
|
||||
case V1_20_R1 -> new V1_20_R1();
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
@ -92,7 +89,7 @@ public class ExcellentEnchants extends NexPlugin<ExcellentEnchants> {
|
||||
@Override
|
||||
public void loadLang() {
|
||||
this.getLangManager().loadMissing(Lang.class);
|
||||
this.getLangManager().setupEnum(FitItemType.class);
|
||||
this.getLangManager().loadEnum(FitItemType.class);
|
||||
this.getLang().saveChanges();
|
||||
}
|
||||
|
||||
@ -108,7 +105,7 @@ public class ExcellentEnchants extends NexPlugin<ExcellentEnchants> {
|
||||
@Override
|
||||
public void registerHooks() {
|
||||
if (Config.ENCHANTMENTS_DISPLAY_MODE.get() == 2) {
|
||||
if (Hooks.hasPlugin(HookId.PROTOCOL_LIB)) {
|
||||
if (EngineUtils.hasPlugin(HookId.PROTOCOL_LIB)) {
|
||||
ProtocolHook.setup();
|
||||
}
|
||||
else {
|
||||
@ -116,7 +113,7 @@ public class ExcellentEnchants extends NexPlugin<ExcellentEnchants> {
|
||||
Config.ENCHANTMENTS_DISPLAY_MODE.set(1);
|
||||
}
|
||||
}
|
||||
if (Hooks.hasPlaceholderAPI()) {
|
||||
if (EngineUtils.hasPlaceholderAPI()) {
|
||||
PlaceholderHook.setup();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,6 @@
|
||||
package su.nightexpress.excellentenchants.api.enchantment;
|
||||
|
||||
public interface Cleanable {
|
||||
|
||||
void clear();
|
||||
}
|
@ -76,7 +76,7 @@ public class BookCommand extends AbstractCommand<ExcellentEnchants> {
|
||||
|
||||
plugin.getMessage(Lang.COMMAND_BOOK_DONE)
|
||||
.replace(Placeholders.GENERIC_ENCHANT, LangManager.getEnchantment(enchantment))
|
||||
.replace(Placeholders.Player.replacer(player))
|
||||
.replace(Placeholders.forPlayer(player))
|
||||
.send(sender);
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ public class EnchantCommand extends AbstractCommand<ExcellentEnchants> {
|
||||
Player player = (Player) sender;
|
||||
ItemStack item = player.getInventory().getItemInMainHand();
|
||||
if (item.getType().isAir()) {
|
||||
this.errorItem(sender);
|
||||
this.plugin.getMessage(Lang.COMMAND_ENCHANT_ERROR_NO_ITEM).send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ public class TierbookCommand extends AbstractCommand<ExcellentEnchants> {
|
||||
|
||||
plugin.getMessage(Lang.COMMAND_TIER_BOOK_DONE)
|
||||
.replace(tier.replacePlaceholders())
|
||||
.replace(Placeholders.Player.replacer(player))
|
||||
.replace(Placeholders.forPlayer(player))
|
||||
.send(sender);
|
||||
}
|
||||
}
|
||||
|
@ -8,18 +8,19 @@ public class Lang extends EngineLang {
|
||||
|
||||
public static final LangKey COMMAND_LIST_DESC = LangKey.of("Command.List.Desc", "List of all custom enchantments.");
|
||||
|
||||
public static final LangKey COMMAND_ENCHANT_USAGE = LangKey.of("Command.Enchant.Usage", "<enchant> <level>");
|
||||
public static final LangKey COMMAND_ENCHANT_DESC = LangKey.of("Command.Enchant.Desc", "Enchants the item in your hand.");
|
||||
public static final LangKey COMMAND_ENCHANT_DONE = LangKey.of("Command.Enchant.Done", "&aSuccessfully enchanted!");
|
||||
public static final LangKey COMMAND_ENCHANT_USAGE = LangKey.of("Command.Enchant.Usage", "<enchant> <level>");
|
||||
public static final LangKey COMMAND_ENCHANT_DESC = LangKey.of("Command.Enchant.Desc", "Enchants the item in your hand.");
|
||||
public static final LangKey COMMAND_ENCHANT_DONE = LangKey.of("Command.Enchant.Done", "&aSuccessfully enchanted!");
|
||||
public static final LangKey COMMAND_ENCHANT_ERROR_NO_ITEM = LangKey.of("Command.Enchant.Error.NoItem", RED + "You must hold an item to enchant it!");
|
||||
|
||||
public static final LangKey COMMAND_BOOK_USAGE = LangKey.of("Command.Book.Usage", "<player> <enchant> <level>");
|
||||
public static final LangKey COMMAND_BOOK_DESC = LangKey.of("Command.Book.Desc", "Gives custom enchanted book.");
|
||||
public static final LangKey COMMAND_BOOK_DONE = LangKey.of("Command.Book.Done", "Given &6" + Placeholders.GENERIC_ENCHANT + "&7 enchanted book to &6" + Placeholders.Player.DISPLAY_NAME + "&7.");
|
||||
public static final LangKey COMMAND_BOOK_DONE = LangKey.of("Command.Book.Done", "Given &6" + Placeholders.GENERIC_ENCHANT + "&7 enchanted book to &6" + Placeholders.PLAYER_DISPLAY_NAME + "&7.");
|
||||
|
||||
public static final LangKey COMMAND_TIER_BOOK_USAGE = LangKey.of("Command.TierBook.Usage", "<player> <tier> <level>");
|
||||
public static final LangKey COMMAND_TIER_BOOK_DESC = LangKey.of("Command.TierBook.Desc", "Gives an enchanted book.");
|
||||
public static final LangKey COMMAND_TIER_BOOK_ERROR = LangKey.of("Command.TierBook.Error", "&cInvalid tier!");
|
||||
public static final LangKey COMMAND_TIER_BOOK_DONE = LangKey.of("Command.TierBook.Done", "Given &6" + Placeholders.TIER_NAME + "&7 enchanted book to &6" + Placeholders.Player.DISPLAY_NAME + "&7.");
|
||||
public static final LangKey COMMAND_TIER_BOOK_DONE = LangKey.of("Command.TierBook.Done", "Given &6" + Placeholders.TIER_NAME + "&7 enchanted book to &6" + Placeholders.PLAYER_DISPLAY_NAME + "&7.");
|
||||
|
||||
public static final LangKey ERROR_NO_ENCHANT = LangKey.of("Error.NoEnchant", "&cInvalid enchantment.");
|
||||
|
||||
|
@ -9,7 +9,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import su.nexmedia.engine.api.config.JYML;
|
||||
import su.nexmedia.engine.api.manager.IListener;
|
||||
import su.nexmedia.engine.api.manager.EventListener;
|
||||
import su.nexmedia.engine.api.placeholder.PlaceholderMap;
|
||||
import su.nexmedia.engine.lang.LangManager;
|
||||
import su.nexmedia.engine.utils.ItemUtil;
|
||||
@ -33,7 +33,7 @@ import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public abstract class ExcellentEnchant extends Enchantment implements IEnchantment, IListener {
|
||||
public abstract class ExcellentEnchant extends Enchantment implements IEnchantment, EventListener {
|
||||
|
||||
protected final ExcellentEnchants plugin;
|
||||
protected final JYML cfg;
|
||||
|
@ -17,12 +17,12 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.inventory.EntityEquipment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import su.nexmedia.engine.api.manager.ICleanable;
|
||||
import su.nexmedia.engine.api.particle.SimpleParticle;
|
||||
import su.nexmedia.engine.api.server.AbstractTask;
|
||||
import su.nexmedia.engine.utils.Pair;
|
||||
import su.nexmedia.engine.utils.random.Rnd;
|
||||
import su.nightexpress.excellentenchants.ExcellentEnchants;
|
||||
import su.nightexpress.excellentenchants.api.enchantment.Cleanable;
|
||||
import su.nightexpress.excellentenchants.enchantment.config.EnchantScaler;
|
||||
import su.nightexpress.excellentenchants.enchantment.impl.ExcellentEnchant;
|
||||
import su.nightexpress.excellentenchants.enchantment.util.EnchantPriority;
|
||||
@ -33,7 +33,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class EnchantFlameWalker extends ExcellentEnchant implements ICleanable {
|
||||
public class EnchantFlameWalker extends ExcellentEnchant implements Cleanable {
|
||||
|
||||
public static final String ID = "flame_walker";
|
||||
|
||||
|
@ -7,12 +7,12 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import su.nexmedia.engine.api.config.JOption;
|
||||
import su.nexmedia.engine.api.manager.ICleanable;
|
||||
import su.nexmedia.engine.api.particle.SimpleParticle;
|
||||
import su.nexmedia.engine.utils.EntityUtil;
|
||||
import su.nexmedia.engine.utils.NumberUtil;
|
||||
import su.nightexpress.excellentenchants.ExcellentEnchants;
|
||||
import su.nightexpress.excellentenchants.Placeholders;
|
||||
import su.nightexpress.excellentenchants.api.enchantment.Cleanable;
|
||||
import su.nightexpress.excellentenchants.api.enchantment.meta.Chanced;
|
||||
import su.nightexpress.excellentenchants.api.enchantment.type.PassiveEnchant;
|
||||
import su.nightexpress.excellentenchants.enchantment.config.EnchantScaler;
|
||||
@ -22,7 +22,7 @@ import su.nightexpress.excellentenchants.enchantment.task.AbstractEnchantmentTas
|
||||
import su.nightexpress.excellentenchants.enchantment.util.EnchantPriority;
|
||||
import su.nightexpress.excellentenchants.enchantment.util.EnchantUtils;
|
||||
|
||||
public class EnchantRegrowth extends ExcellentEnchant implements Chanced, PassiveEnchant, ICleanable {
|
||||
public class EnchantRegrowth extends ExcellentEnchant implements Chanced, PassiveEnchant, Cleanable {
|
||||
|
||||
public static final String ID = "regrowth";
|
||||
|
||||
|
@ -6,10 +6,10 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import su.nexmedia.engine.api.config.JOption;
|
||||
import su.nexmedia.engine.api.manager.ICleanable;
|
||||
import su.nexmedia.engine.utils.NumberUtil;
|
||||
import su.nightexpress.excellentenchants.ExcellentEnchants;
|
||||
import su.nightexpress.excellentenchants.Placeholders;
|
||||
import su.nightexpress.excellentenchants.api.enchantment.Cleanable;
|
||||
import su.nightexpress.excellentenchants.api.enchantment.type.PassiveEnchant;
|
||||
import su.nightexpress.excellentenchants.enchantment.config.EnchantScaler;
|
||||
import su.nightexpress.excellentenchants.enchantment.impl.ExcellentEnchant;
|
||||
@ -17,7 +17,7 @@ import su.nightexpress.excellentenchants.enchantment.task.AbstractEnchantmentTas
|
||||
import su.nightexpress.excellentenchants.enchantment.util.EnchantPriority;
|
||||
import su.nightexpress.excellentenchants.enchantment.util.EnchantUtils;
|
||||
|
||||
public class EnchantSaturation extends ExcellentEnchant implements PassiveEnchant, ICleanable {
|
||||
public class EnchantSaturation extends ExcellentEnchant implements PassiveEnchant, Cleanable {
|
||||
|
||||
public static final String ID = "saturation";
|
||||
|
||||
|
@ -9,7 +9,7 @@ import org.bukkit.event.player.PlayerFishEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import su.nexmedia.engine.api.particle.SimpleParticle;
|
||||
import su.nexmedia.engine.utils.MessageUtil;
|
||||
import su.nexmedia.engine.utils.PlayerUtil;
|
||||
import su.nightexpress.excellentenchants.ExcellentEnchants;
|
||||
import su.nightexpress.excellentenchants.Placeholders;
|
||||
import su.nightexpress.excellentenchants.api.enchantment.meta.Chanced;
|
||||
@ -65,7 +65,7 @@ public class CurseOfDrownedEnchant extends ExcellentEnchant implements FishingEn
|
||||
|
||||
if (this.hasVisualEffects()) {
|
||||
SimpleParticle.of(Particle.WATER_SPLASH).play(hook.getLocation(), 0.5, 0.1, 50);
|
||||
MessageUtil.sound(event.getPlayer(), Sound.ENTITY_DROWNED_AMBIENT);
|
||||
PlayerUtil.sound(event.getPlayer(), Sound.ENTITY_DROWNED_AMBIENT);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public final class ArrowImplementation implements Arrowed {
|
||||
(cfg1, path, def) -> SimpleParticle.read(cfg1, path),
|
||||
particle,
|
||||
"Sets particle effect for the arrow trail of this enchantment."
|
||||
).setWriter((cfg1, path, particle1) -> SimpleParticle.write(particle1, cfg1, path)).read(cfg);
|
||||
).setWriter((cfg1, path, particle1) -> particle1.write(cfg1, path)).read(cfg);
|
||||
|
||||
return new ArrowImplementation(enchant, effect);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package su.nightexpress.excellentenchants.enchantment.impl.tool;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
@ -21,6 +22,7 @@ import su.nexmedia.engine.api.config.JOption;
|
||||
import su.nexmedia.engine.api.particle.SimpleParticle;
|
||||
import su.nexmedia.engine.utils.Colorizer;
|
||||
import su.nexmedia.engine.utils.LocationUtil;
|
||||
import su.nexmedia.engine.utils.PDCUtil;
|
||||
import su.nightexpress.excellentenchants.ExcellentEnchants;
|
||||
import su.nightexpress.excellentenchants.Placeholders;
|
||||
import su.nightexpress.excellentenchants.api.enchantment.meta.Chanced;
|
||||
@ -40,8 +42,12 @@ public class EnchantDivineTouch extends ExcellentEnchant implements Chanced, Blo
|
||||
private String spawnerName;
|
||||
private ChanceImplementation chanceImplementation;
|
||||
|
||||
private final NamespacedKey key;
|
||||
|
||||
public EnchantDivineTouch(@NotNull ExcellentEnchants plugin) {
|
||||
super(plugin, ID, EnchantPriority.MEDIUM);
|
||||
this.key = new NamespacedKey(plugin, "divine_spawner");
|
||||
|
||||
this.getDefaults().setDescription(Placeholders.ENCHANTMENT_CHANCE + "% chance to mine spawner.");
|
||||
this.getDefaults().setLevelMax(5);
|
||||
this.getDefaults().setTier(1.0);
|
||||
@ -91,6 +97,7 @@ public class EnchantDivineTouch extends ExcellentEnchant implements Chanced, Blo
|
||||
stateItem.setDisplayName(this.spawnerName.replace(Placeholders.GENERIC_TYPE, plugin.getLangManager().getEnum(spawnerBlock.getSpawnedType())));
|
||||
itemSpawner.setItemMeta(stateItem);
|
||||
|
||||
PDCUtil.set(itemSpawner, this.key, true);
|
||||
return itemSpawner;
|
||||
}
|
||||
|
||||
@ -133,6 +140,7 @@ public class EnchantDivineTouch extends ExcellentEnchant implements Chanced, Blo
|
||||
Player player = e.getPlayer();
|
||||
ItemStack spawner = player.getInventory().getItem(e.getHand());
|
||||
if (spawner == null || spawner.getType() != Material.SPAWNER || !(spawner.getItemMeta() instanceof BlockStateMeta meta)) return;
|
||||
if (PDCUtil.getBoolean(spawner, this.key).isEmpty()) return;
|
||||
|
||||
CreatureSpawner spawnerItem = (CreatureSpawner) meta.getBlockState();
|
||||
CreatureSpawner spawnerBlock = (CreatureSpawner) block.getState();
|
||||
|
@ -15,15 +15,15 @@ import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import su.nexmedia.engine.api.config.JOption;
|
||||
import su.nexmedia.engine.utils.MessageUtil;
|
||||
import su.nexmedia.engine.utils.PlayerUtil;
|
||||
import su.nightexpress.excellentenchants.ExcellentEnchants;
|
||||
import su.nightexpress.excellentenchants.enchantment.impl.ExcellentEnchant;
|
||||
import su.nightexpress.excellentenchants.api.enchantment.meta.Chanced;
|
||||
import su.nightexpress.excellentenchants.api.enchantment.type.BlockBreakEnchant;
|
||||
import su.nightexpress.excellentenchants.api.enchantment.type.InteractEnchant;
|
||||
import su.nightexpress.excellentenchants.enchantment.util.EnchantPriority;
|
||||
import su.nightexpress.excellentenchants.enchantment.impl.ExcellentEnchant;
|
||||
import su.nightexpress.excellentenchants.enchantment.impl.meta.ChanceImplementation;
|
||||
import su.nightexpress.excellentenchants.enchantment.type.FitItemType;
|
||||
import su.nightexpress.excellentenchants.enchantment.util.EnchantPriority;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@ -147,7 +147,7 @@ public class EnchantReplanter extends ExcellentEnchant implements Chanced, Inter
|
||||
if (seed == Material.NETHER_WART && blockGround.getType() == Material.SOUL_SAND
|
||||
|| seed != Material.NETHER_WART && blockGround.getType() == Material.FARMLAND) {
|
||||
if (this.takeSeeds(player, seed)) {
|
||||
MessageUtil.sound(player, seed == Material.NETHER_WART ? Sound.ITEM_NETHER_WART_PLANT : Sound.ITEM_CROP_PLANT);
|
||||
PlayerUtil.sound(player, seed == Material.NETHER_WART ? Sound.ITEM_NETHER_WART_PLANT : Sound.ITEM_CROP_PLANT);
|
||||
plugin.getEnchantNMS().sendAttackPacket(player, 0);
|
||||
blockPlant.setType(this.fineSeedsToBlock(seed));
|
||||
break;
|
||||
|
@ -25,16 +25,14 @@ import su.nexmedia.engine.utils.ItemUtil;
|
||||
import su.nexmedia.engine.utils.PDCUtil;
|
||||
import su.nightexpress.excellentenchants.ExcellentEnchants;
|
||||
import su.nightexpress.excellentenchants.Placeholders;
|
||||
import su.nightexpress.excellentenchants.enchantment.impl.ExcellentEnchant;
|
||||
import su.nightexpress.excellentenchants.api.enchantment.type.BlockDropEnchant;
|
||||
import su.nightexpress.excellentenchants.enchantment.impl.ExcellentEnchant;
|
||||
import su.nightexpress.excellentenchants.enchantment.type.FitItemType;
|
||||
import su.nightexpress.excellentenchants.enchantment.util.EnchantDropContainer;
|
||||
import su.nightexpress.excellentenchants.enchantment.util.EnchantPriority;
|
||||
import su.nightexpress.excellentenchants.enchantment.type.FitItemType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class EnchantSilkChest extends ExcellentEnchant implements BlockDropEnchant {
|
||||
@ -44,7 +42,6 @@ public class EnchantSilkChest extends ExcellentEnchant implements BlockDropEncha
|
||||
private String chestName;
|
||||
private List<String> chestLore;
|
||||
private final NamespacedKey keyChest;
|
||||
@Deprecated private final Map<Integer, NamespacedKey> keyItems;
|
||||
|
||||
public EnchantSilkChest(@NotNull ExcellentEnchants plugin) {
|
||||
super(plugin, ID, EnchantPriority.HIGH);
|
||||
@ -53,10 +50,6 @@ public class EnchantSilkChest extends ExcellentEnchant implements BlockDropEncha
|
||||
this.getDefaults().setTier(0.5);
|
||||
|
||||
this.keyChest = new NamespacedKey(plugin, ID + ".item");
|
||||
this.keyItems = new TreeMap<>();
|
||||
for (int pos = 0; pos < 27; pos++) {
|
||||
this.getItemKey(pos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -70,11 +63,6 @@ public class EnchantSilkChest extends ExcellentEnchant implements BlockDropEncha
|
||||
"Use '" + Placeholders.GENERIC_AMOUNT + "' for items amount.").mapReader(Colorizer::apply).read(cfg);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private NamespacedKey getItemKey(int pos) {
|
||||
return this.keyItems.computeIfAbsent(pos, key -> new NamespacedKey(plugin, "silkchest_item_" + pos));
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public FitItemType[] getFitItemTypes() {
|
||||
@ -88,7 +76,7 @@ public class EnchantSilkChest extends ExcellentEnchant implements BlockDropEncha
|
||||
}
|
||||
|
||||
public boolean isSilkChest(@NotNull ItemStack item) {
|
||||
return PDCUtil.getBoolean(item, this.keyChest).orElse(false) || PDCUtil.getString(item, this.getItemKey(0)).orElse(null) != null;
|
||||
return PDCUtil.getBoolean(item, this.keyChest).isPresent();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@ -174,15 +162,6 @@ public class EnchantSilkChest extends ExcellentEnchant implements BlockDropEncha
|
||||
|
||||
chest.setCustomName(null);
|
||||
chest.update(true);
|
||||
|
||||
Inventory inventory = chest.getBlockInventory();
|
||||
for (int pos = 0; pos < inventory.getSize(); pos++) {
|
||||
String data = PDCUtil.getString(item, this.getItemKey(pos)).orElse(null);
|
||||
if (data == null) continue;
|
||||
|
||||
ItemStack itemInv = ItemUtil.fromBase64(data);
|
||||
inventory.setItem(pos, itemInv);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
|
@ -15,7 +15,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import su.nexmedia.engine.api.config.JOption;
|
||||
import su.nexmedia.engine.api.particle.SimpleParticle;
|
||||
import su.nexmedia.engine.utils.LocationUtil;
|
||||
import su.nexmedia.engine.utils.MessageUtil;
|
||||
import su.nightexpress.excellentenchants.ExcellentEnchants;
|
||||
import su.nightexpress.excellentenchants.Placeholders;
|
||||
import su.nightexpress.excellentenchants.api.enchantment.meta.Chanced;
|
||||
@ -104,7 +103,7 @@ public class EnchantSmelter extends ExcellentEnchant implements Chanced, BlockDr
|
||||
Block block = e.getBlockState().getBlock();
|
||||
if (this.hasVisualEffects()) {
|
||||
Location location = LocationUtil.getCenter(block.getLocation(), true);
|
||||
MessageUtil.sound(location, this.sound);
|
||||
LocationUtil.sound(location, this.sound);
|
||||
SimpleParticle.of(Particle.FLAME).play(location, 0.25, 0.05, 20);
|
||||
}
|
||||
return true;
|
||||
|
@ -10,24 +10,24 @@ import org.bukkit.event.block.BlockDropItemEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import su.nexmedia.engine.api.manager.ICleanable;
|
||||
import su.nexmedia.engine.utils.random.Rnd;
|
||||
import su.nexmedia.playerblocktracker.PlayerBlockTracker;
|
||||
import su.nightexpress.excellentenchants.ExcellentEnchants;
|
||||
import su.nightexpress.excellentenchants.Placeholders;
|
||||
import su.nightexpress.excellentenchants.enchantment.impl.ExcellentEnchant;
|
||||
import su.nightexpress.excellentenchants.api.enchantment.Cleanable;
|
||||
import su.nightexpress.excellentenchants.api.enchantment.meta.Chanced;
|
||||
import su.nightexpress.excellentenchants.api.enchantment.type.BlockBreakEnchant;
|
||||
import su.nightexpress.excellentenchants.api.enchantment.type.BlockDropEnchant;
|
||||
import su.nightexpress.excellentenchants.enchantment.util.EnchantDropContainer;
|
||||
import su.nightexpress.excellentenchants.enchantment.util.EnchantPriority;
|
||||
import su.nightexpress.excellentenchants.enchantment.impl.ExcellentEnchant;
|
||||
import su.nightexpress.excellentenchants.enchantment.impl.meta.ChanceImplementation;
|
||||
import su.nightexpress.excellentenchants.enchantment.type.FitItemType;
|
||||
import su.nightexpress.excellentenchants.enchantment.util.EnchantDropContainer;
|
||||
import su.nightexpress.excellentenchants.enchantment.util.EnchantPriority;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class EnchantTreasures extends ExcellentEnchant implements Chanced, BlockBreakEnchant, BlockDropEnchant, ICleanable {
|
||||
public class EnchantTreasures extends ExcellentEnchant implements Chanced, BlockBreakEnchant, BlockDropEnchant, Cleanable {
|
||||
|
||||
public static final String ID = "treasures";
|
||||
private static final String META = "wasted";
|
||||
|
@ -10,7 +10,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import su.nexmedia.engine.api.config.JOption;
|
||||
import su.nexmedia.engine.utils.LocationUtil;
|
||||
import su.nexmedia.engine.utils.EntityUtil;
|
||||
import su.nightexpress.excellentenchants.ExcellentEnchants;
|
||||
import su.nightexpress.excellentenchants.api.enchantment.type.BlockBreakEnchant;
|
||||
import su.nightexpress.excellentenchants.enchantment.impl.ExcellentEnchant;
|
||||
@ -75,7 +75,7 @@ public class EnchantTunnel extends ExcellentEnchant implements BlockBreakEnchant
|
||||
if (block.getType().isInteractable() && !INTERACTABLE_BLOCKS.contains(block.getType())) return false;
|
||||
if (block.getDrops(item).isEmpty()) return false;
|
||||
|
||||
BlockFace dir = LocationUtil.getDirection(player);
|
||||
BlockFace dir = EntityUtil.getDirection(player);
|
||||
boolean isY = dir != null && block.getRelative(dir.getOppositeFace()).isEmpty();
|
||||
boolean isZ = dir == BlockFace.EAST || dir == BlockFace.WEST;
|
||||
|
||||
|
@ -12,7 +12,7 @@ import org.bukkit.inventory.meta.Damageable;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import su.nexmedia.engine.api.particle.SimpleParticle;
|
||||
import su.nexmedia.engine.utils.MessageUtil;
|
||||
import su.nexmedia.engine.utils.LocationUtil;
|
||||
import su.nexmedia.engine.utils.NumberUtil;
|
||||
import su.nexmedia.engine.utils.random.Rnd;
|
||||
import su.nightexpress.excellentenchants.ExcellentEnchants;
|
||||
@ -98,7 +98,7 @@ public class EnchantCutter extends ExcellentEnchant implements Chanced, CombatEn
|
||||
|
||||
if (this.hasVisualEffects()) {
|
||||
SimpleParticle.of(Particle.ITEM_CRACK, itemCut).play(victim.getEyeLocation(), 0.25, 0.15, 30);
|
||||
MessageUtil.sound(victim.getLocation(), Sound.ENTITY_ITEM_BREAK);
|
||||
LocationUtil.sound(victim.getLocation(), Sound.ENTITY_ITEM_BREAK);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import su.nexmedia.engine.api.config.JOption;
|
||||
import su.nexmedia.engine.api.particle.SimpleParticle;
|
||||
import su.nexmedia.engine.lang.LangManager;
|
||||
import su.nexmedia.engine.utils.Colorizer;
|
||||
import su.nexmedia.engine.utils.ItemUtil;
|
||||
import su.nexmedia.engine.utils.PDCUtil;
|
||||
import su.nexmedia.engine.utils.StringUtil;
|
||||
@ -71,7 +72,8 @@ public class EnchantDecapitator extends ExcellentEnchant implements Chanced, Dea
|
||||
).setWriter((cfg, path, set) -> cfg.set(path, set.stream().map(Enum::name).toList())).read(cfg);
|
||||
|
||||
this.headName = JOption.create("Settings.Head_Item.Name", "&c" + Placeholders.GENERIC_TYPE + "'s Head",
|
||||
"Head item display name. Use '" + Placeholders.GENERIC_TYPE + "' for entity name.").read(cfg);
|
||||
"Head item display name. Use '" + Placeholders.GENERIC_TYPE + "' for entity name.")
|
||||
.mapReader(Colorizer::apply).read(cfg);
|
||||
|
||||
this.headTextures = JOption.forMap("Settings.Head_Item.Textures",
|
||||
id -> StringUtil.getEnum(id, EntityType.class).orElse(null),
|
||||
|
@ -8,7 +8,7 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import su.nexmedia.engine.api.particle.SimpleParticle;
|
||||
import su.nexmedia.engine.utils.MessageUtil;
|
||||
import su.nexmedia.engine.utils.LocationUtil;
|
||||
import su.nightexpress.excellentenchants.ExcellentEnchants;
|
||||
import su.nightexpress.excellentenchants.Placeholders;
|
||||
import su.nightexpress.excellentenchants.api.enchantment.meta.Chanced;
|
||||
@ -58,7 +58,7 @@ public class EnchantDoubleStrike extends ExcellentEnchant implements Chanced, Co
|
||||
|
||||
if (this.hasVisualEffects()) {
|
||||
SimpleParticle.of(Particle.EXPLOSION_NORMAL).play(victim.getEyeLocation(), 0.25, 0.15, 15);
|
||||
MessageUtil.sound(victim.getLocation(), Sound.ENTITY_GENERIC_EXPLODE);
|
||||
LocationUtil.sound(victim.getLocation(), Sound.ENTITY_GENERIC_EXPLODE);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.FireworkMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import su.nexmedia.engine.utils.MessageUtil;
|
||||
import su.nexmedia.engine.utils.LocationUtil;
|
||||
import su.nexmedia.engine.utils.random.Rnd;
|
||||
import su.nightexpress.excellentenchants.ExcellentEnchants;
|
||||
import su.nightexpress.excellentenchants.Placeholders;
|
||||
@ -72,7 +72,7 @@ public class EnchantRocket extends ExcellentEnchant implements Chanced, CombatEn
|
||||
Firework firework = this.createRocket(victim.getLocation(), level);
|
||||
firework.addPassenger(victim);
|
||||
|
||||
MessageUtil.sound(victim.getLocation(), Sound.ENTITY_FIREWORK_ROCKET_LAUNCH);
|
||||
LocationUtil.sound(victim.getLocation(), Sound.ENTITY_FIREWORK_ROCKET_LAUNCH);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,8 @@ import org.bukkit.inventory.AnvilInventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import su.nexmedia.engine.api.manager.AbstractListener;
|
||||
import su.nexmedia.engine.utils.MessageUtil;
|
||||
import su.nexmedia.engine.utils.PDCUtil;
|
||||
import su.nexmedia.engine.utils.PlayerUtil;
|
||||
import su.nightexpress.excellentenchants.ExcellentEnchants;
|
||||
import su.nightexpress.excellentenchants.ExcellentEnchantsAPI;
|
||||
import su.nightexpress.excellentenchants.enchantment.impl.ExcellentEnchant;
|
||||
@ -149,7 +149,7 @@ public class EnchantAnvilListener extends AbstractListener<ExcellentEnchants> {
|
||||
e.getView().setCursor(item);
|
||||
e.setCancelled(false);
|
||||
|
||||
MessageUtil.sound(player, Sound.BLOCK_ENCHANTMENT_TABLE_USE);
|
||||
PlayerUtil.sound(player, Sound.BLOCK_ENCHANTMENT_TABLE_USE);
|
||||
|
||||
ItemStack second = inventory.getItem(1);
|
||||
if (second != null && !second.getType().isAir()) {
|
||||
|
@ -19,11 +19,11 @@ import org.bukkit.inventory.meta.EnchantmentStorageMeta;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import su.nexmedia.engine.api.manager.AbstractListener;
|
||||
import su.nexmedia.engine.hooks.Hooks;
|
||||
import su.nexmedia.engine.utils.EngineUtils;
|
||||
import su.nightexpress.excellentenchants.ExcellentEnchants;
|
||||
import su.nightexpress.excellentenchants.enchantment.impl.ExcellentEnchant;
|
||||
import su.nightexpress.excellentenchants.config.Config;
|
||||
import su.nightexpress.excellentenchants.enchantment.EnchantManager;
|
||||
import su.nightexpress.excellentenchants.enchantment.impl.ExcellentEnchant;
|
||||
import su.nightexpress.excellentenchants.enchantment.type.ObtainType;
|
||||
import su.nightexpress.excellentenchants.enchantment.util.EnchantUtils;
|
||||
import su.nightexpress.excellentenchants.hook.HookId;
|
||||
@ -191,7 +191,7 @@ public class EnchantGenericListener extends AbstractListener<ExcellentEnchants>
|
||||
EntityEquipment equipment = entity.getEquipment();
|
||||
if (equipment == null) return;
|
||||
|
||||
boolean isMythic = Hooks.hasPlugin(HookId.MYTHIC_MOBS) && MythicMobsHook.isMythicMob(entity);
|
||||
boolean isMythic = EngineUtils.hasPlugin(HookId.MYTHIC_MOBS) && MythicMobsHook.isMythicMob(entity);
|
||||
boolean doPopulation = Config.getObtainSettings(ObtainType.MOB_SPAWNING).isPresent() && !isMythic;
|
||||
|
||||
for (EquipmentSlot slot : EquipmentSlot.values()) {
|
||||
|
@ -130,9 +130,9 @@ public class EnchantmentsListMenu extends ConfigMenu<ExcellentEnchants> implemen
|
||||
List<String> charges = enchant.isChargesEnabled() ? new ArrayList<>(this.enchantLoreCharges) : Collections.emptyList();
|
||||
List<String> obtaining = new ArrayList<>(this.enchantLoreObtaining);
|
||||
|
||||
lore = StringUtil.replace(lore, PLACEHOLDER_CONFLICTS, false, conflicts);
|
||||
lore = StringUtil.replace(lore, PLACEHOLDER_CHARGES, false, charges);
|
||||
lore = StringUtil.replace(lore, PLACEHOLDER_OBTAINING, false, obtaining);
|
||||
lore = StringUtil.replaceInList(lore, PLACEHOLDER_CONFLICTS, conflicts);
|
||||
lore = StringUtil.replaceInList(lore, PLACEHOLDER_CHARGES, charges);
|
||||
lore = StringUtil.replaceInList(lore, PLACEHOLDER_OBTAINING, obtaining);
|
||||
lore = StringUtil.replace(lore, Placeholders.ENCHANTMENT_DESCRIPTION, true, enchant.getDescription());
|
||||
|
||||
meta.setLore(lore);
|
||||
|
@ -5,19 +5,19 @@ import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||
import fr.neatmonster.nocheatplus.hooks.ExemptionContext;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import su.nexmedia.engine.hooks.Hooks;
|
||||
import su.nexmedia.engine.utils.EngineUtils;
|
||||
import su.nightexpress.excellentenchants.hook.HookId;
|
||||
|
||||
public class NoCheatPlusHook {
|
||||
|
||||
public static void exemptBlocks(@NotNull Player player) {
|
||||
if (!Hooks.hasPlugin(HookId.NCP)) return;
|
||||
if (!EngineUtils.hasPlugin(HookId.NCP)) return;
|
||||
|
||||
NCPAPIProvider.getNoCheatPlusAPI().getPlayerDataManager().getPlayerData(player).exempt(CheckType.BLOCKBREAK, ExemptionContext.ANONYMOUS_NESTED);
|
||||
}
|
||||
|
||||
public static void unexemptBlocks(@NotNull Player player) {
|
||||
if (!Hooks.hasPlugin(HookId.NCP)) return;
|
||||
if (!EngineUtils.hasPlugin(HookId.NCP)) return;
|
||||
|
||||
NCPAPIProvider.getNoCheatPlusAPI().getPlayerDataManager().getPlayerData(player).unexempt(CheckType.BLOCKBREAK, ExemptionContext.ANONYMOUS_NESTED);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>ExcellentEnchants</artifactId>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<version>3.4.3</version>
|
||||
<version>3.4.5</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>ExcellentEnchants</artifactId>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<version>3.4.3</version>
|
||||
<version>3.4.5</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
<dependency>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<artifactId>NMS</artifactId>
|
||||
<version>3.4.3</version>
|
||||
<version>3.4.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>ExcellentEnchants</artifactId>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<version>3.4.3</version>
|
||||
<version>3.4.5</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
<dependency>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<artifactId>NMS</artifactId>
|
||||
<version>3.4.3</version>
|
||||
<version>3.4.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
@ -1,71 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>ExcellentEnchants</artifactId>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<version>3.4.3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>V1_19_R1</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>16</maven.compiler.source>
|
||||
<maven.compiler.target>16</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.19.2-R0.1-SNAPSHOT</version>
|
||||
<classifier>remapped-mojang</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<artifactId>NMS</artifactId>
|
||||
<version>3.4.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>specialsource-maven-plugin</artifactId>
|
||||
<version>1.2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>remap</goal>
|
||||
</goals>
|
||||
<id>remap-obf</id>
|
||||
<configuration>
|
||||
<srgIn>org.spigotmc:minecraft-server:1.19.2-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
|
||||
<reverse>true</reverse>
|
||||
<remappedDependencies>org.spigotmc:spigot:1.19.2-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
|
||||
<remappedArtifactAttached>true</remappedArtifactAttached>
|
||||
<remappedClassifierName>remapped-obf</remappedClassifierName>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>remap</goal>
|
||||
</goals>
|
||||
<id>remap-spigot</id>
|
||||
<configuration>
|
||||
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
|
||||
<srgIn>org.spigotmc:minecraft-server:1.19.2-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
|
||||
<remappedDependencies>org.spigotmc:spigot:1.19.2-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
@ -1,94 +0,0 @@
|
||||
package su.nightexpress.excellentenchants.nms.v1_19_R1;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.protocol.game.ClientboundAnimatePacket;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.projectile.FishingHook;
|
||||
import net.minecraft.world.item.SpawnEggItem;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.LiquidBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_19_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftFishHook;
|
||||
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_19_R1.event.CraftEventFactory;
|
||||
import org.bukkit.craftbukkit.v1_19_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.FishHook;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import su.nightexpress.excellentenchants.nms.EnchantNMS;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class V1_19_R1 implements EnchantNMS {
|
||||
|
||||
@Override
|
||||
public void sendAttackPacket(@NotNull Player player, int id) {
|
||||
CraftPlayer craftPlayer = (CraftPlayer) player;
|
||||
Entity entity = craftPlayer.getHandle();
|
||||
ClientboundAnimatePacket packet = new ClientboundAnimatePacket(entity, id);
|
||||
craftPlayer.getHandle().connection.send(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void retrieveHook(@NotNull FishHook hook, @NotNull ItemStack item) {
|
||||
CraftFishHook craftFishHook = (CraftFishHook) hook;
|
||||
FishingHook handle = craftFishHook.getHandle();
|
||||
handle.retrieve(CraftItemStack.asNMSCopy(item));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ItemStack getSpawnEgg(@NotNull LivingEntity entity) {
|
||||
CraftLivingEntity craftLivingEntity = (CraftLivingEntity) entity;
|
||||
net.minecraft.world.entity.LivingEntity livingEntity = craftLivingEntity.getHandle();
|
||||
|
||||
SpawnEggItem eggItem = SpawnEggItem.byId(livingEntity.getType());
|
||||
if (eggItem == null) return null;
|
||||
|
||||
return CraftItemStack.asBukkitCopy(eggItem.getDefaultInstance());
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Set<Block> handleFlameWalker(@NotNull LivingEntity bukkitEntity, @NotNull Location location, int level) {
|
||||
Entity entity = ((CraftLivingEntity) bukkitEntity).getHandle();
|
||||
BlockPos pos = new BlockPos(location.getX(), location.getY(), location.getZ());
|
||||
ServerLevel world = ((CraftWorld) bukkitEntity.getWorld()).getHandle();
|
||||
|
||||
float radius = Math.min(16F, 2F + level);
|
||||
BlockState bStone = Blocks.MAGMA_BLOCK.defaultBlockState();
|
||||
BlockPos.MutableBlockPos posAbove = new BlockPos.MutableBlockPos();
|
||||
|
||||
Set<Block> blocks = new HashSet<>();
|
||||
for (BlockPos posNear : BlockPos.betweenClosed(pos.offset(-radius, -1.0, -radius), pos.offset(radius, -1.0, radius))) {
|
||||
if (!posNear.closerThan(entity.blockPosition(), radius)) continue;
|
||||
|
||||
posAbove.set(posNear.getX(), posNear.getY() + 1, posNear.getZ());
|
||||
|
||||
BlockState bLavaAbove = world.getBlockState(posAbove);
|
||||
BlockState bLava = world.getBlockState(posNear);
|
||||
|
||||
if (!bLavaAbove.isAir()) continue;
|
||||
if (!bLava.getBlock().equals(Blocks.LAVA)) continue;
|
||||
if (bLava.getValue(LiquidBlock.LEVEL) != 0) continue;
|
||||
if (!bStone.canSurvive(world, posNear)) continue;
|
||||
if (!world.isUnobstructed(bStone, posNear, CollisionContext.empty())) continue;
|
||||
if (!CraftEventFactory.handleBlockFormEvent(world, posNear, bStone, entity)) continue;
|
||||
//world.scheduleTick(posNear, Blocks.STONE, Rnd.get(60, 120));
|
||||
|
||||
Location bukkitLoc = new Location(world.getWorld(), posNear.getX(), posNear.getY(), posNear.getZ());
|
||||
blocks.add(bukkitLoc.getBlock());
|
||||
}
|
||||
return blocks;
|
||||
}
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>ExcellentEnchants</artifactId>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<version>3.4.3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>V1_19_R2</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>16</maven.compiler.source>
|
||||
<maven.compiler.target>16</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.19.3-R0.1-SNAPSHOT</version>
|
||||
<classifier>remapped-mojang</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<artifactId>NMS</artifactId>
|
||||
<version>3.4.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>specialsource-maven-plugin</artifactId>
|
||||
<version>1.2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>remap</goal>
|
||||
</goals>
|
||||
<id>remap-obf</id>
|
||||
<configuration>
|
||||
<srgIn>org.spigotmc:minecraft-server:1.19.3-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
|
||||
<reverse>true</reverse>
|
||||
<remappedDependencies>org.spigotmc:spigot:1.19.3-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
|
||||
<remappedArtifactAttached>true</remappedArtifactAttached>
|
||||
<remappedClassifierName>remapped-obf</remappedClassifierName>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>remap</goal>
|
||||
</goals>
|
||||
<id>remap-spigot</id>
|
||||
<configuration>
|
||||
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
|
||||
<srgIn>org.spigotmc:minecraft-server:1.19.3-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
|
||||
<remappedDependencies>org.spigotmc:spigot:1.19.3-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -1,94 +0,0 @@
|
||||
package su.nightexpress.excellentenchants.nms.v1_19_R2;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.protocol.game.ClientboundAnimatePacket;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.projectile.FishingHook;
|
||||
import net.minecraft.world.item.SpawnEggItem;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.LiquidBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_19_R2.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftFishHook;
|
||||
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_19_R2.event.CraftEventFactory;
|
||||
import org.bukkit.craftbukkit.v1_19_R2.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.FishHook;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import su.nightexpress.excellentenchants.nms.EnchantNMS;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class V1_19_R2 implements EnchantNMS {
|
||||
|
||||
@Override
|
||||
public void sendAttackPacket(@NotNull Player player, int id) {
|
||||
CraftPlayer craftPlayer = (CraftPlayer) player;
|
||||
Entity entity = craftPlayer.getHandle();
|
||||
ClientboundAnimatePacket packet = new ClientboundAnimatePacket(entity, id);
|
||||
craftPlayer.getHandle().connection.send(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void retrieveHook(@NotNull FishHook hook, @NotNull ItemStack item) {
|
||||
CraftFishHook craftFishHook = (CraftFishHook) hook;
|
||||
FishingHook handle = craftFishHook.getHandle();
|
||||
handle.retrieve(CraftItemStack.asNMSCopy(item));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ItemStack getSpawnEgg(@NotNull LivingEntity entity) {
|
||||
CraftLivingEntity craftLivingEntity = (CraftLivingEntity) entity;
|
||||
net.minecraft.world.entity.LivingEntity livingEntity = craftLivingEntity.getHandle();
|
||||
|
||||
SpawnEggItem eggItem = SpawnEggItem.byId(livingEntity.getType());
|
||||
if (eggItem == null) return null;
|
||||
|
||||
return CraftItemStack.asBukkitCopy(eggItem.getDefaultInstance());
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Set<Block> handleFlameWalker(@NotNull LivingEntity bukkitEntity, @NotNull Location location, int level) {
|
||||
Entity entity = ((CraftLivingEntity) bukkitEntity).getHandle();
|
||||
BlockPos pos = new BlockPos(location.getX(), location.getY(), location.getZ());
|
||||
ServerLevel world = ((CraftWorld) bukkitEntity.getWorld()).getHandle();
|
||||
|
||||
float radius = Math.min(16F, 2F + level);
|
||||
BlockState bStone = Blocks.MAGMA_BLOCK.defaultBlockState();
|
||||
BlockPos.MutableBlockPos posAbove = new BlockPos.MutableBlockPos();
|
||||
|
||||
Set<Block> blocks = new HashSet<>();
|
||||
for (BlockPos posNear : BlockPos.betweenClosed(pos.offset(-radius, -1.0, -radius), pos.offset(radius, -1.0, radius))) {
|
||||
if (!posNear.closerThan(entity.blockPosition(), radius)) continue;
|
||||
|
||||
posAbove.set(posNear.getX(), posNear.getY() + 1, posNear.getZ());
|
||||
|
||||
BlockState bLavaAbove = world.getBlockState(posAbove);
|
||||
BlockState bLava = world.getBlockState(posNear);
|
||||
|
||||
if (!bLavaAbove.isAir()) continue;
|
||||
if (!bLava.getBlock().equals(Blocks.LAVA)) continue;
|
||||
if (bLava.getValue(LiquidBlock.LEVEL) != 0) continue;
|
||||
if (!bStone.canSurvive(world, posNear)) continue;
|
||||
if (!world.isUnobstructed(bStone, posNear, CollisionContext.empty())) continue;
|
||||
if (!CraftEventFactory.handleBlockFormEvent(world, posNear, bStone, entity)) continue;
|
||||
//world.scheduleTick(posNear, Blocks.STONE, Rnd.get(60, 120));
|
||||
|
||||
Location bukkitLoc = new Location(world.getWorld(), posNear.getX(), posNear.getY(), posNear.getZ());
|
||||
blocks.add(bukkitLoc.getBlock());
|
||||
}
|
||||
return blocks;
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>ExcellentEnchants</artifactId>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<version>3.4.3</version>
|
||||
<version>3.4.5</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
<dependency>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<artifactId>NMS</artifactId>
|
||||
<version>3.4.3</version>
|
||||
<version>3.4.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>ExcellentEnchants</artifactId>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<version>3.4.3</version>
|
||||
<version>3.4.5</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
<dependency>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<artifactId>NMS</artifactId>
|
||||
<version>3.4.3</version>
|
||||
<version>3.4.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
6
pom.xml
6
pom.xml
@ -7,14 +7,12 @@
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<artifactId>ExcellentEnchants</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>3.4.3</version>
|
||||
<version>3.4.5</version>
|
||||
<modules>
|
||||
<module>Core</module>
|
||||
<module>NMS</module>
|
||||
<module>V1_17_R1</module>
|
||||
<module>V1_18_R2</module>
|
||||
<module>V1_19_R1</module>
|
||||
<module>V1_19_R2</module>
|
||||
<module>V1_19_R3</module>
|
||||
<module>V1_20_R1</module>
|
||||
</modules>
|
||||
@ -30,7 +28,7 @@
|
||||
<dependency>
|
||||
<groupId>su.nexmedia</groupId>
|
||||
<artifactId>NexEngine</artifactId>
|
||||
<version>2.2.10</version>
|
||||
<version>2.2.11</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user