diff --git a/.gitignore b/.gitignore index e400327..b413499 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,6 @@ /V1_19_R2/target/ /V1_19_R2/pom.xml.versionsBackup /V1_19_R3/target/ -/V1_19_R3/pom.xml.versionsBackup \ No newline at end of file +/V1_19_R3/pom.xml.versionsBackup +/V1_20_R1/target/ +/V1_20_R1/pom.xml.versionsBackup \ No newline at end of file diff --git a/Core/pom.xml b/Core/pom.xml index 91ee7f1..a54054a 100644 --- a/Core/pom.xml +++ b/Core/pom.xml @@ -5,7 +5,7 @@ ExcellentEnchants su.nightexpress.excellentenchants - 3.4.1 + 3.4.3 4.0.0 @@ -62,42 +62,7 @@ org.spigotmc spigot-api - 1.19.4-R0.1-SNAPSHOT - - - su.nexmedia.playerblocktracker - PlayerBlockTracker - 1.0.1 - - - su.nightexpress.excellentenchants - NMS - 3.4.1 - - - su.nightexpress.excellentenchants - V1_19_R3 - 3.4.1 - - - su.nightexpress.excellentenchants - V1_19_R2 - 3.4.1 - - - su.nightexpress.excellentenchants - V1_19_R1 - 3.4.1 - - - su.nightexpress.excellentenchants - V1_18_R2 - 3.4.1 - - - su.nightexpress.excellentenchants - V1_17_R1 - 3.4.1 + 1.20.1-R0.1-SNAPSHOT fr.neatmonster @@ -122,6 +87,46 @@ 2.11.2 provided + + su.nexmedia.playerblocktracker + PlayerBlockTracker + 1.0.1 + + + su.nightexpress.excellentenchants + NMS + 3.4.3 + + + su.nightexpress.excellentenchants + V1_17_R1 + 3.4.3 + + + su.nightexpress.excellentenchants + V1_18_R2 + 3.4.3 + + + su.nightexpress.excellentenchants + V1_19_R1 + 3.4.3 + + + su.nightexpress.excellentenchants + V1_19_R2 + 3.4.3 + + + su.nightexpress.excellentenchants + V1_19_R3 + 3.4.3 + + + su.nightexpress.excellentenchants + V1_20_R1 + 3.4.3 + diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/ExcellentEnchants.java b/Core/src/main/java/su/nightexpress/excellentenchants/ExcellentEnchants.java index 966f7d6..22b20cd 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/ExcellentEnchants.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/ExcellentEnchants.java @@ -24,6 +24,7 @@ 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; public class ExcellentEnchants extends NexPlugin { @@ -79,6 +80,7 @@ public class ExcellentEnchants extends NexPlugin { 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(); }; } diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/EnchantFlameWalker.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/EnchantFlameWalker.java index 61363e8..09cd0d8 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/EnchantFlameWalker.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/armor/EnchantFlameWalker.java @@ -148,7 +148,7 @@ public class EnchantFlameWalker extends ExcellentEnchant implements ICleanable { long now = System.currentTimeMillis(); BLOCKS_TO_DESTROY.keySet().removeIf(block -> { - if (block.isEmpty()) return true; + if (block.isEmpty() || block.getType() != Material.MAGMA_BLOCK) return true; Pair pair = BLOCKS_TO_DESTROY.get(block); long time = pair.getFirst(); diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/task/AbstractEnchantmentTask.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/task/AbstractEnchantmentTask.java index 525cb96..df7d292 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/task/AbstractEnchantmentTask.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/task/AbstractEnchantmentTask.java @@ -17,7 +17,7 @@ public abstract class AbstractEnchantmentTask extends AbstractTask getEntities() { + protected Collection getEntities() { Set list = new HashSet<>(plugin.getServer().getOnlinePlayers()); if (Config.ENCHANTMENTS_ENTITY_PASSIVE_FOR_MOBS.get()) { diff --git a/NMS/pom.xml b/NMS/pom.xml index 1114606..381596e 100644 --- a/NMS/pom.xml +++ b/NMS/pom.xml @@ -5,7 +5,7 @@ ExcellentEnchants su.nightexpress.excellentenchants - 3.4.1 + 3.4.3 4.0.0 diff --git a/V1_17_R1/pom.xml b/V1_17_R1/pom.xml index 18bfc79..91407e6 100644 --- a/V1_17_R1/pom.xml +++ b/V1_17_R1/pom.xml @@ -5,7 +5,7 @@ ExcellentEnchants su.nightexpress.excellentenchants - 3.4.1 + 3.4.3 4.0.0 @@ -26,7 +26,7 @@ su.nightexpress.excellentenchants NMS - 3.4.1 + 3.4.3 diff --git a/V1_18_R2/pom.xml b/V1_18_R2/pom.xml index 8621259..fb1ff53 100644 --- a/V1_18_R2/pom.xml +++ b/V1_18_R2/pom.xml @@ -5,7 +5,7 @@ ExcellentEnchants su.nightexpress.excellentenchants - 3.4.1 + 3.4.3 4.0.0 @@ -26,7 +26,7 @@ su.nightexpress.excellentenchants NMS - 3.4.1 + 3.4.3 diff --git a/V1_19_R1/pom.xml b/V1_19_R1/pom.xml index ccc39d1..0a4ed48 100644 --- a/V1_19_R1/pom.xml +++ b/V1_19_R1/pom.xml @@ -5,7 +5,7 @@ ExcellentEnchants su.nightexpress.excellentenchants - 3.4.1 + 3.4.3 4.0.0 @@ -26,7 +26,7 @@ su.nightexpress.excellentenchants NMS - 3.4.1 + 3.4.3 diff --git a/V1_19_R2/pom.xml b/V1_19_R2/pom.xml index 055a99d..8a8913c 100644 --- a/V1_19_R2/pom.xml +++ b/V1_19_R2/pom.xml @@ -5,7 +5,7 @@ ExcellentEnchants su.nightexpress.excellentenchants - 3.4.1 + 3.4.3 4.0.0 @@ -26,7 +26,7 @@ su.nightexpress.excellentenchants NMS - 3.4.1 + 3.4.3 diff --git a/V1_19_R3/pom.xml b/V1_19_R3/pom.xml index f60cc8b..0d2a789 100644 --- a/V1_19_R3/pom.xml +++ b/V1_19_R3/pom.xml @@ -5,7 +5,7 @@ ExcellentEnchants su.nightexpress.excellentenchants - 3.4.1 + 3.4.3 4.0.0 @@ -26,7 +26,7 @@ su.nightexpress.excellentenchants NMS - 3.4.1 + 3.4.3 diff --git a/V1_20_R1/pom.xml b/V1_20_R1/pom.xml new file mode 100644 index 0000000..4a5d1ea --- /dev/null +++ b/V1_20_R1/pom.xml @@ -0,0 +1,71 @@ + + + + ExcellentEnchants + su.nightexpress.excellentenchants + 3.4.3 + + 4.0.0 + + V1_20_R1 + + + 16 + 16 + + + + + org.spigotmc + spigot + 1.20.1-R0.1-SNAPSHOT + remapped-mojang + + + su.nightexpress.excellentenchants + NMS + 3.4.3 + + + + + + + net.md-5 + specialsource-maven-plugin + 1.2.4 + + + package + + remap + + remap-obf + + org.spigotmc:minecraft-server:1.20.1-R0.1-SNAPSHOT:txt:maps-mojang + true + org.spigotmc:spigot:1.20.1-R0.1-SNAPSHOT:jar:remapped-mojang + true + remapped-obf + + + + package + + remap + + remap-spigot + + ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar + org.spigotmc:minecraft-server:1.20.1-R0.1-SNAPSHOT:csrg:maps-spigot + org.spigotmc:spigot:1.20.1-R0.1-SNAPSHOT:jar:remapped-obf + + + + + + + + \ No newline at end of file diff --git a/V1_20_R1/src/main/java/su/nightexpress/excellentenchants/nms/v1_20_R1/V1_20_R1.java b/V1_20_R1/src/main/java/su/nightexpress/excellentenchants/nms/v1_20_R1/V1_20_R1.java new file mode 100644 index 0000000..4a2dfe4 --- /dev/null +++ b/V1_20_R1/src/main/java/su/nightexpress/excellentenchants/nms/v1_20_R1/V1_20_R1.java @@ -0,0 +1,94 @@ +package su.nightexpress.excellentenchants.nms.v1_20_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_20_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_20_R1.entity.CraftFishHook; +import org.bukkit.craftbukkit.v1_20_R1.entity.CraftLivingEntity; +import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_20_R1.event.CraftEventFactory; +import org.bukkit.craftbukkit.v1_20_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_20_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 handleFlameWalker(@NotNull LivingEntity bukkitEntity, @NotNull Location location, int level) { + Entity entity = ((CraftLivingEntity) bukkitEntity).getHandle(); + BlockPos pos = new BlockPos(location.getBlockX(), location.getBlockY(), location.getBlockZ()); + ServerLevel world = ((CraftWorld) bukkitEntity.getWorld()).getHandle(); + + int radius = Math.min(16, 2 + level); + BlockState bStone = Blocks.MAGMA_BLOCK.defaultBlockState(); + BlockPos.MutableBlockPos posAbove = new BlockPos.MutableBlockPos(); + + Set blocks = new HashSet<>(); + for (BlockPos posNear : BlockPos.betweenClosed(pos.offset(-radius, -1, -radius), pos.offset(radius, -1, 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; + } +} diff --git a/pom.xml b/pom.xml index 63c1ec0..3d18962 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ su.nightexpress.excellentenchants ExcellentEnchants pom - 3.4.1 + 3.4.3 Core NMS @@ -16,6 +16,7 @@ V1_19_R1 V1_19_R2 V1_19_R3 + V1_20_R1