From f5bd6683b69bb26270b833731a148f3165de5523 Mon Sep 17 00:00:00 2001 From: JasperLorelai Date: Mon, 6 Apr 2026 01:32:57 +0200 Subject: [PATCH 1/3] chore: Bump versions --- .github/workflows/build.yml | 2 +- build.gradle | 4 +- buildSrc/build.gradle.kts | 6 +- .../dev/magicspells/gradle/MSJavaPlugin.java | 44 ++- .../dev/magicspells/gradle/MSPaperweight.java | 12 - core/build.gradle | 28 +- .../java/com/nisovin/magicspells/Spell.java | 2 +- core/src/main/resources/plugin.yml | 2 +- gradle.properties | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- jitpack.yml | 5 +- nms/latest/build.gradle | 2 +- .../latest/VolatileCodeLatest.java | 8 +- .../latest/VolatileGlowManagerLatest.java | 2 +- nms/shared/build.gradle | 2 +- nms/v1_21_10/build.gradle | 8 - .../v1_21_10/VolatileCode_v1_21_10.java | 293 ---------------- .../VolatileGlowManager_v1_21_10.java | 321 ------------------ settings.gradle.kts | 1 - shop/build.gradle | 2 +- 20 files changed, 49 insertions(+), 699 deletions(-) delete mode 100644 buildSrc/src/main/java/dev/magicspells/gradle/MSPaperweight.java delete mode 100644 nms/v1_21_10/build.gradle delete mode 100644 nms/v1_21_10/src/main/java/com/nisovin/magicspells/volatilecode/v1_21_10/VolatileCode_v1_21_10.java delete mode 100644 nms/v1_21_10/src/main/java/com/nisovin/magicspells/volatilecode/v1_21_10/VolatileGlowManager_v1_21_10.java diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b7ed175e7..d8069adf7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,7 +48,7 @@ jobs: uses: actions/setup-java@v4 with: distribution: temurin - java-version: 21 + java-version: 25 - name: Setup Gradle uses: gradle/actions/setup-gradle@v4 diff --git a/build.gradle b/build.gradle index 948a21e05..d79cd5a39 100644 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,13 @@ plugins { id("dev.magicspells.msjava") - id("io.papermc.paperweight.userdev") version "2.0.0-beta.19" apply false + id("io.papermc.paperweight.userdev") version "2.0.0-beta.21" apply false } subprojects { apply plugin: "dev.magicspells.msjava" dependencies { - implementation("io.papermc.paper:paper-api:1.21.10-R0.1-SNAPSHOT") + implementation("io.papermc.paper:paper-api:26.1.1.build.+") } processResources { diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 3259bc704..f75b70e2a 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -8,7 +8,7 @@ repositories { java { toolchain { - languageVersion.set(JavaLanguageVersion.of(21)) + languageVersion.set(JavaLanguageVersion.of(25)) } } @@ -18,9 +18,5 @@ gradlePlugin { id = "dev.magicspells.msjava" implementationClass = "dev.magicspells.gradle.MSJavaPlugin" }) - create("mspaperweight", Action { - id = "dev.magicspells.mspaperweight" - implementationClass = "dev.magicspells.gradle.MSPaperweight" - }) } } diff --git a/buildSrc/src/main/java/dev/magicspells/gradle/MSJavaPlugin.java b/buildSrc/src/main/java/dev/magicspells/gradle/MSJavaPlugin.java index 5e50667e4..3ffc41e5d 100644 --- a/buildSrc/src/main/java/dev/magicspells/gradle/MSJavaPlugin.java +++ b/buildSrc/src/main/java/dev/magicspells/gradle/MSJavaPlugin.java @@ -10,36 +10,34 @@ import org.gradle.api.publish.maven.plugins.MavenPublishPlugin; public class MSJavaPlugin implements Plugin { + + private static final String[] MAVEN_URLS = new String[]{ + "https://mvn.lib.co.nz/public/", + "https://repo.papermc.io/repository/maven-public/", + "https://jitpack.io", + "https://repo.codemc.org/repository/maven-public", + "https://maven.enginehub.org/repo/", + "https://repo.glaremasters.me/repository/towny/", + "https://repo.extendedclip.com/releases/", + }; + @Override public void apply(Project target) { target.getPlugins().apply(JavaPlugin.class); target.getPlugins().apply(JavaLibraryPlugin.class); target.getPlugins().apply(MavenPublishPlugin.class); - target.getExtensions().configure(JavaPluginExtension.class, (JavaPluginExtension ext) -> { - ext.toolchain((javaToolchainSpec -> { - javaToolchainSpec.getLanguageVersion().set(JavaLanguageVersion.of(21)); - })); - }); + + target.getExtensions() + .getByType(JavaPluginExtension.class) + .getToolchain() + .getLanguageVersion() + .set(JavaLanguageVersion.of(25)); + RepositoryHandler repositories = target.getRepositories(); repositories.mavenCentral(); - - String[] mavenUrls = new String[] { - "https://repo.dmulloy2.net/nexus/repository/public/", - "https://repo.md-5.net/content/repositories/releases/", - "https://repo.papermc.io/repository/maven-public/", - "https://oss.sonatype.org/content/repositories/central", - "https://oss.sonatype.org/content/repositories/snapshots", - "https://hub.spigotmc.org/nexus/content/repositories/snapshots/", - "https://jitpack.io", - "https://repo.codemc.org/repository/maven-public", - "https://cdn.rawgit.com/Rayzr522/maven-repo/master/", - "https://maven.enginehub.org/repo/", - "https://repo.glaremasters.me/repository/towny/", - "https://repo.extendedclip.com/content/repositories/placeholderapi", - "https://repo.md-5.net/content/repositories/snapshots", - }; - for (String url : mavenUrls) { - repositories.maven(mavenArtifactRepository -> mavenArtifactRepository.setUrl(url)); + for (String url : MAVEN_URLS) { + repositories.maven(repo -> repo.setUrl(url)); } } + } diff --git a/buildSrc/src/main/java/dev/magicspells/gradle/MSPaperweight.java b/buildSrc/src/main/java/dev/magicspells/gradle/MSPaperweight.java deleted file mode 100644 index 2f5750524..000000000 --- a/buildSrc/src/main/java/dev/magicspells/gradle/MSPaperweight.java +++ /dev/null @@ -1,12 +0,0 @@ -package dev.magicspells.gradle; - -import org.gradle.api.Plugin; -import org.gradle.api.Project; - -public class MSPaperweight implements Plugin { - // TODO figure out how to apply the plugin - @Override - public void apply(Project project) { - project.getDependencies().add("paperweightDevelopmentBundle", "io.papermc.paper:dev-bundle:1.21.10-R0.1-SNAPSHOT").because("We need a server implementation rather than just an api here."); - } -} diff --git a/core/build.gradle b/core/build.gradle index 65e15e446..644b9dc63 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -1,31 +1,30 @@ plugins { - id("com.gradleup.shadow") version "9.2.2" + id("com.gradleup.shadow") version "9.4.1" id("antlr") } dependencies { shadow("org.apache.commons:commons-math4-core:4.0-beta1") - shadow("com.github.ben-manes.caffeine:caffeine:3.2.1") + shadow("com.github.ben-manes.caffeine:caffeine:3.2.2") shadow("com.github.Chronoken:EffectLib:4e37625") shadow("org.incendo:cloud-paper:2.0.0-beta.14") - shadow("org.incendo:cloud-minecraft-extras:2.0.0-beta.13") + shadow("org.incendo:cloud-minecraft-extras:2.0.0-SNAPSHOT") shadow("org.incendo:cloud-processors-requirements:1.0.0-rc.1") - shadow("org.bstats:bstats-bukkit:3.0.2") - shadow("com.github.ezylang:EvalEx:0dcb042") + shadow("org.bstats:bstats-bukkit:3.2.1") + shadow("com.github.ezylang:EvalEx:3.6.0") shadow("org.antlr:antlr4-runtime:4.13.2") antlr("org.antlr:antlr4:4.13.2") shadow(project(path: ":nms:shared", configuration: "apiElements")) shadow(project(path: ":nms:latest")) { transitive = false } - shadow(project(path: ":nms:v1_21_10")) { transitive = false } - implementation("com.github.retrooper:packetevents-spigot:2.10.1") + implementation("com.github.retrooper:packetevents-spigot:2.11.2") implementation("net.dmulloy2:ProtocolLib:5.4.0") { transitive = false } - implementation("me.libraryaddict.disguises:libsdisguises:10.0.44-SNAPSHOT") { transitive = false } + implementation("me.libraryaddict.disguises:libsdisguises:11.0.16-SNAPSHOT") { transitive = false } implementation("net.milkbowl.vault:VaultAPI:1.7") { transitive = false } - implementation("me.clip:placeholderapi:2.11.6") { transitive = false } - implementation("com.github.GriefPrevention:GriefPrevention:17.0.0") { transitive = false } + implementation("me.clip:placeholderapi:2.12.2") { transitive = false } + implementation("com.github.GriefPrevention:GriefPrevention:18.0.0") { transitive = false } implementation("com.github.Xezard:XGlow:1.1.0") { exclude(module: "XGlowPlugin") exclude(module: "XGlowExample") @@ -34,21 +33,12 @@ dependencies { implementation("com.sk89q.worldguard:worldguard-bukkit:7.1.0-SNAPSHOT") { transitive = false } implementation("com.sk89q.worldedit:worldedit-core:7.4.0-SNAPSHOT") { transitive = false } implementation("com.sk89q.worldedit:worldedit-bukkit:7.4.0-SNAPSHOT") { transitive = false } - } base { archivesName = "MagicSpells" } -jar { - manifest { - attributes( - "paperweight-mappings-namespace": "mojang" - ) - } -} - shadowJar { configurations = [project.configurations.shadow] diff --git a/core/src/main/java/com/nisovin/magicspells/Spell.java b/core/src/main/java/com/nisovin/magicspells/Spell.java index e4fe926d3..f7db15374 100644 --- a/core/src/main/java/com/nisovin/magicspells/Spell.java +++ b/core/src/main/java/com/nisovin/magicspells/Spell.java @@ -1568,7 +1568,7 @@ protected TargetInfo getTargetedEntity(SpellData data, boolean for World world = caster.getWorld(); boolean targetPlayers = forceTargetPlayers || validTargetList.canTargetPlayers(); - if (targetPlayers && MagicSpells.checkWorldPvpFlag() && caster instanceof Player && !isBeneficial() && Boolean.FALSE.equals(world.getGameRuleValue(GameRule.PVP))) { + if (targetPlayers && MagicSpells.checkWorldPvpFlag() && caster instanceof Player && !isBeneficial() && Boolean.FALSE.equals(world.getGameRuleValue(GameRules.PVP))) { if (forceTargetPlayers) return new TargetInfo<>(null, data, false); targetPlayers = false; } diff --git a/core/src/main/resources/plugin.yml b/core/src/main/resources/plugin.yml index 749ee9d76..07e77a5bf 100644 --- a/core/src/main/resources/plugin.yml +++ b/core/src/main/resources/plugin.yml @@ -3,7 +3,7 @@ main: com.nisovin.magicspells.MagicSpells version: $version authors: [nisovin, TheComputerGeek2, Chronoken, tonythemacaroni, JasperLorelai] website: "https://github.com/TheComputerGeek2/MagicSpells/" -api-version: "1.21.10" +api-version: "26.1.1" softdepend: - GriefPrevention - Vault diff --git a/gradle.properties b/gradle.properties index b785544f7..931e73225 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version = 4.0-Beta-18 +version = 4.0-Beta-19 groupId = com.nisovin.magicspells org.gradle.parallel=true diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2e1113280..c61a118f7 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/jitpack.yml b/jitpack.yml index 727c9abd3..2e1371153 100644 --- a/jitpack.yml +++ b/jitpack.yml @@ -1,2 +1,3 @@ -jdk: - - openjdk21 +before_install: + - sdk install java 25.0.2-tem + - sdk use java 25.0.2-tem diff --git a/nms/latest/build.gradle b/nms/latest/build.gradle index 85f35d747..ddc317887 100644 --- a/nms/latest/build.gradle +++ b/nms/latest/build.gradle @@ -3,6 +3,6 @@ plugins { } dependencies { - paperweight.paperDevBundle("1.21.11-rc2-R0.1-SNAPSHOT") + paperweight.paperDevBundle("26.1.1.build.+") implementation project(":nms:shared") } diff --git a/nms/latest/src/main/java/com/nisovin/magicspells/volatilecode/latest/VolatileCodeLatest.java b/nms/latest/src/main/java/com/nisovin/magicspells/volatilecode/latest/VolatileCodeLatest.java index e852cdaa2..8034727e9 100644 --- a/nms/latest/src/main/java/com/nisovin/magicspells/volatilecode/latest/VolatileCodeLatest.java +++ b/nms/latest/src/main/java/com/nisovin/magicspells/volatilecode/latest/VolatileCodeLatest.java @@ -65,9 +65,9 @@ public class VolatileCodeLatest extends VolatileCodeHandle { private final Identifier TOAST_KEY = Identifier.fromNamespaceAndPath("magicspells", "toast_effect"); - private final EntityDataAccessor<@NotNull List> DATA_EFFECT_PARTICLES; - private final EntityDataAccessor<@NotNull Boolean> DATA_EFFECT_AMBIENCE_ID; - private final EntityDataAccessor<@NotNull Byte> DATA_SHARED_FLAGS_ID; + private final EntityDataAccessor> DATA_EFFECT_PARTICLES; + private final EntityDataAccessor DATA_EFFECT_AMBIENCE_ID; + private final EntityDataAccessor DATA_SHARED_FLAGS_ID; private final MethodHandle UPDATE_EFFECT_PARTICLES; private final Long2ObjectOpenHashMap> GLOBAL_REGION_TASKS; @@ -202,7 +202,7 @@ public void playHurtSound(LivingEntity entity) { @Override public void sendToastEffect(Player receiver, ItemStack icon, AdvancementDisplay.Frame frameType, Component text) { - var iconNms = CraftItemStack.asNMSCopy(icon); + var iconNms = CraftItemStack.asNMSCopy(icon).getItem(); var textNms = PaperAdventure.asVanilla(text); var description = PaperAdventure.asVanilla(Component.empty()); AdvancementType frame; diff --git a/nms/latest/src/main/java/com/nisovin/magicspells/volatilecode/latest/VolatileGlowManagerLatest.java b/nms/latest/src/main/java/com/nisovin/magicspells/volatilecode/latest/VolatileGlowManagerLatest.java index 4a812b63a..b70df77e6 100644 --- a/nms/latest/src/main/java/com/nisovin/magicspells/volatilecode/latest/VolatileGlowManagerLatest.java +++ b/nms/latest/src/main/java/com/nisovin/magicspells/volatilecode/latest/VolatileGlowManagerLatest.java @@ -44,7 +44,7 @@ public class VolatileGlowManagerLatest extends PacketBasedGlowManager, ClientboundSetEntityDataPacket, ClientboundSetPlayerTeamPacket> { - private static final EntityDataAccessor<@NotNull Byte> DATA_SHARED_FLAGS_ID = new EntityDataAccessor<>(0, EntityDataSerializers.BYTE); + private static final EntityDataAccessor DATA_SHARED_FLAGS_ID = new EntityDataAccessor<>(0, EntityDataSerializers.BYTE); private final Set> handled = Collections.synchronizedSet(Collections.newSetFromMap(new WeakHashMap<>())); private final MethodHandle teamPacketHandle; diff --git a/nms/shared/build.gradle b/nms/shared/build.gradle index 484c4bb35..cf2607414 100644 --- a/nms/shared/build.gradle +++ b/nms/shared/build.gradle @@ -1,3 +1,3 @@ dependencies { - implementation("me.libraryaddict.disguises:libsdisguises:10.0.44-SNAPSHOT") { transitive = false } + implementation("me.libraryaddict.disguises:libsdisguises:11.0.16-SNAPSHOT") { transitive = false } } diff --git a/nms/v1_21_10/build.gradle b/nms/v1_21_10/build.gradle deleted file mode 100644 index 2ce8c3dae..000000000 --- a/nms/v1_21_10/build.gradle +++ /dev/null @@ -1,8 +0,0 @@ -plugins { - id "io.papermc.paperweight.userdev" -} - -dependencies { - paperweight.paperDevBundle("1.21.10-R0.1-SNAPSHOT") - implementation project(":nms:shared") -} diff --git a/nms/v1_21_10/src/main/java/com/nisovin/magicspells/volatilecode/v1_21_10/VolatileCode_v1_21_10.java b/nms/v1_21_10/src/main/java/com/nisovin/magicspells/volatilecode/v1_21_10/VolatileCode_v1_21_10.java deleted file mode 100644 index 78eae3250..000000000 --- a/nms/v1_21_10/src/main/java/com/nisovin/magicspells/volatilecode/v1_21_10/VolatileCode_v1_21_10.java +++ /dev/null @@ -1,293 +0,0 @@ -package com.nisovin.magicspells.volatilecode.v1_21_10; - -import java.util.*; -import java.lang.invoke.VarHandle; -import java.util.function.Consumer; -import java.lang.invoke.MethodType; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; - -import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; - -import org.bukkit.World; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.util.Vector; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; -import org.bukkit.entity.LivingEntity; -import org.bukkit.inventory.ItemStack; -import org.bukkit.event.entity.ExplosionPrimeEvent; - -import org.bukkit.craftbukkit.CraftWorld; -import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.craftbukkit.entity.CraftEntity; -import org.bukkit.craftbukkit.entity.CraftPlayer; -import org.bukkit.craftbukkit.entity.CraftTNTPrimed; -import org.bukkit.craftbukkit.inventory.CraftItemStack; -import org.bukkit.craftbukkit.entity.CraftLivingEntity; - -import net.kyori.adventure.text.Component; - -import io.papermc.paper.adventure.PaperAdventure; -import io.papermc.paper.advancement.AdvancementDisplay; -import io.papermc.paper.threadedregions.EntityScheduler; -import io.papermc.paper.threadedregions.scheduler.ScheduledTask; -import io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler; - -import com.nisovin.magicspells.util.glow.GlowManager; -import com.nisovin.magicspells.volatilecode.VolatileCodeHandle; -import com.nisovin.magicspells.volatilecode.VolatileCodeHelper; - -import net.minecraft.util.ARGB; -import net.minecraft.core.BlockPos; -import net.minecraft.advancements.*; -import net.minecraft.world.phys.Vec3; -import net.minecraft.server.MinecraftServer; -import net.minecraft.world.entity.EntityType; -import net.minecraft.network.protocol.game.*; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.item.PrimedTnt; -import net.minecraft.core.particles.ParticleTypes; -import net.minecraft.core.particles.ParticleOptions; -import net.minecraft.network.syncher.SynchedEntityData; -import net.minecraft.network.syncher.EntityDataAccessor; -import net.minecraft.core.particles.ColorParticleOption; -import net.minecraft.advancements.critereon.ImpossibleTrigger; -import net.minecraft.world.entity.boss.enderdragon.EnderDragon; -import org.jetbrains.annotations.NotNull; - -public class VolatileCode_v1_21_10 extends VolatileCodeHandle { - - private final ResourceLocation TOAST_KEY = ResourceLocation.fromNamespaceAndPath("magicspells", "toast_effect"); - - private final EntityDataAccessor> DATA_EFFECT_PARTICLES; - private final EntityDataAccessor DATA_EFFECT_AMBIENCE_ID; - private final EntityDataAccessor DATA_SHARED_FLAGS_ID; - private final MethodHandle UPDATE_EFFECT_PARTICLES; - - private final Long2ObjectOpenHashMap> GLOBAL_REGION_TASKS; - private final VarHandle CURRENTLY_EXECUTING_HANDLE; - private final VarHandle ONE_TIME_DELAYED_HANDLE; - private final VarHandle RUN_HANDLE; - - @SuppressWarnings("unchecked") - public VolatileCode_v1_21_10(VolatileCodeHelper helper) throws Exception { - super(helper); - - MethodHandles.Lookup lookup = MethodHandles.lookup(); - - Class leClass = net.minecraft.world.entity.LivingEntity.class; - Class eClass = net.minecraft.world.entity.Entity.class; - - DATA_SHARED_FLAGS_ID = (EntityDataAccessor<@NotNull Byte>) MethodHandles.privateLookupIn(eClass, lookup) - .findStaticVarHandle(eClass, "DATA_SHARED_FLAGS_ID", EntityDataAccessor.class).get(); - - MethodHandles.Lookup leLookup = MethodHandles.privateLookupIn(leClass, lookup); - - DATA_EFFECT_PARTICLES = (EntityDataAccessor<@NotNull List>) leLookup - .findStaticVarHandle(leClass, "DATA_EFFECT_PARTICLES", EntityDataAccessor.class).get(); - - DATA_EFFECT_AMBIENCE_ID = (EntityDataAccessor<@NotNull Boolean>) leLookup - .findStaticVarHandle(leClass, "DATA_EFFECT_AMBIENCE_ID", EntityDataAccessor.class).get(); - - UPDATE_EFFECT_PARTICLES = leLookup.findVirtual(leClass, "updateSynchronizedMobEffectParticles", MethodType.methodType(void.class)); - - GLOBAL_REGION_TASKS = (Long2ObjectOpenHashMap>) MethodHandles.privateLookupIn(FoliaGlobalRegionScheduler.class, lookup) - .findVarHandle(FoliaGlobalRegionScheduler.class, "tasksByDeadline", Long2ObjectOpenHashMap.class) - .get(Bukkit.getGlobalRegionScheduler()); - - MethodHandles.Lookup esLookup = MethodHandles.privateLookupIn(EntityScheduler.class, lookup); - - CURRENTLY_EXECUTING_HANDLE = esLookup.findVarHandle(EntityScheduler.class, "currentlyExecuting", ArrayDeque.class); - ONE_TIME_DELAYED_HANDLE = esLookup.findVarHandle(EntityScheduler.class, "oneTimeDelayed", Long2ObjectOpenHashMap.class); - - Class scheduledTaskClass = esLookup.findClass("io.papermc.paper.threadedregions.EntityScheduler$ScheduledTask"); - RUN_HANDLE = esLookup.findVarHandle(scheduledTaskClass, "run", Consumer.class); - } - - @Override - public void addPotionGraphicalEffect(LivingEntity entity, int color, long duration) { - var nmsEntity = (((CraftLivingEntity) entity)).getHandle(); - SynchedEntityData entityData = nmsEntity.getEntityData(); - - entityData.set( - DATA_EFFECT_PARTICLES, - List.of(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, ARGB.opaque(color))) - ); - - entityData.set(DATA_EFFECT_AMBIENCE_ID, false); - - if (duration <= 0) return; - helper.scheduleDelayedTask(() -> { - try { - UPDATE_EFFECT_PARTICLES.invoke(nmsEntity); - } catch (Throwable e) { - e.printStackTrace(); - } - }, duration); - } - - @Override - public void sendFakeSlotUpdate(Player player, int slot, ItemStack item) { - var nmsItem = CraftItemStack.asNMSCopy(item); - ClientboundContainerSetSlotPacket packet = new ClientboundContainerSetSlotPacket(0, 0, slot + 36, nmsItem); - - ((CraftPlayer) player).getHandle().connection.send(packet); - } - - @Override - public boolean simulateTnt(Location target, LivingEntity source, float explosionSize, boolean fire) { - ServerLevel world = ((CraftWorld) target.getWorld()).getHandle(); - var igniter = ((CraftLivingEntity) source).getHandle(); - - PrimedTnt tnt = new PrimedTnt(world, target.x(), target.y(), target.z(), igniter); - CraftTNTPrimed craftTNT = new CraftTNTPrimed((CraftServer) Bukkit.getServer(), tnt); - - return !new ExplosionPrimeEvent(craftTNT, explosionSize, fire).callEvent(); - } - - @Override - public void playDragonDeathEffect(Location location) { - EnderDragon dragon = new EnderDragon(EntityType.ENDER_DRAGON, ((CraftWorld) location.getWorld()).getHandle()); - dragon.setPos(location.x(), location.y(), location.z()); - - BlockPos pos = new BlockPos(location.getBlockX(), location.getBlockY(), location.getBlockZ()); - ClientboundAddEntityPacket addMobPacket = new ClientboundAddEntityPacket(dragon, 0, pos); - ClientboundEntityEventPacket entityEventPacket = new ClientboundEntityEventPacket(dragon, (byte) 3); - ClientboundRemoveEntitiesPacket removeEntityPacket = new ClientboundRemoveEntitiesPacket(dragon.getId()); - - List players = new ArrayList<>(); - for (Player player : location.getNearbyPlayers(64.0)) { - players.add(player); - ServerPlayer nmsPlayer = ((CraftPlayer) player).getHandle(); - nmsPlayer.connection.send(addMobPacket); - nmsPlayer.connection.send(entityEventPacket); - } - - helper.scheduleDelayedTask(() -> { - for (Player player : players) { - if (!player.isValid()) continue; - ((CraftPlayer) player).getHandle().connection.send(removeEntityPacket); - } - }, 200); - } - - @Override - public void setClientVelocity(Player player, Vector velocity) { - Vec3 pos = new Vec3(velocity.getX(), velocity.getY(), velocity.getZ()); - ClientboundSetEntityMotionPacket packet = new ClientboundSetEntityMotionPacket(player.getEntityId(), pos); - ((CraftPlayer) player).getHandle().connection.send(packet); - } - - @Override - public void playHurtSound(LivingEntity entity) { - var nmsEntity = ((CraftLivingEntity) entity).getHandle(); - var sound = nmsEntity.getHurtSound(nmsEntity.damageSources().generic()); - - if (sound == null || nmsEntity.isSilent()) return; - nmsEntity.level().playSound( - null, - nmsEntity.blockPosition(), - sound, - nmsEntity.getSoundSource(), - nmsEntity.getSoundVolume(), - nmsEntity.getVoicePitch() - ); - } - - @Override - public void sendToastEffect(Player receiver, ItemStack icon, AdvancementDisplay.Frame frameType, Component text) { - var iconNms = CraftItemStack.asNMSCopy(icon); - var textNms = PaperAdventure.asVanilla(text); - var description = PaperAdventure.asVanilla(Component.empty()); - AdvancementType frame; - try { - frame = AdvancementType.valueOf(frameType.name()); - } catch (IllegalArgumentException ignored) { - frame = AdvancementType.TASK; - } - - AdvancementHolder advancement = Advancement.Builder.advancement() - .display(iconNms, textNms, description, null, frame, true, false, true) - .addCriterion("impossible", new Criterion<>(new ImpossibleTrigger(), new ImpossibleTrigger.TriggerInstance())) - .build(TOAST_KEY); - AdvancementProgress progress = new AdvancementProgress(); - progress.update(new AdvancementRequirements(List.of(List.of("impossible")))); - progress.grantProgress("impossible"); - - ServerPlayer player = ((CraftPlayer) receiver).getHandle(); - player.connection.send(new ClientboundUpdateAdvancementsPacket( - false, - Collections.singleton(advancement), - Collections.emptySet(), - Collections.singletonMap(TOAST_KEY, progress), - true - )); - player.connection.send(new ClientboundUpdateAdvancementsPacket( - false, - Collections.emptySet(), - Collections.singleton(TOAST_KEY), - Collections.emptyMap(), - true - )); - } - - @Override - public byte getEntityMetadata(Entity entity) { - return ((CraftEntity) entity).getHandle().getEntityData().get(DATA_SHARED_FLAGS_ID); - } - - @Override - public Entity getEntityFromId(World world, int id) { - var entity = ((CraftWorld) world).getHandle().moonrise$getEntityLookup().get(id); - return entity == null ? null : entity.getBukkitEntity(); - } - - @Override - public GlowManager getGlowManager() { - return new VolatileGlowManager_v1_21_10(helper); - } - - @Override - public long countGlobalRegionSchedulerTasks() { - Plugin plugin = helper.getPlugin(); - - return GLOBAL_REGION_TASKS.values().stream() - .flatMap(List::stream) - .filter(task -> task.getOwningPlugin() == plugin) - .count(); - } - - @SuppressWarnings({"rawtypes", "unchecked"}) - @Override - public long countEntitySchedulerTasks() { - EntityScheduler.EntitySchedulerTickList entitySchedulerTickList = MinecraftServer.getServer().entitySchedulerTickList; - EntityScheduler[] schedulers = entitySchedulerTickList.getAllSchedulers(); - Plugin plugin = helper.getPlugin(); - - int count = 0; - for (EntityScheduler scheduler : schedulers) { - Long2ObjectOpenHashMap oneTimeDelayed = (Long2ObjectOpenHashMap) ONE_TIME_DELAYED_HANDLE.get(scheduler); - ArrayDeque currentlyExecuting = (ArrayDeque) CURRENTLY_EXECUTING_HANDLE.get(scheduler); - - for (List taskList : oneTimeDelayed.values()) { - for (Object taskObject : taskList) { - ScheduledTask task = (ScheduledTask) (Consumer) RUN_HANDLE.get(taskObject); - if (task.getOwningPlugin() == plugin) count++; - } - } - - for (Object taskObject : currentlyExecuting) { - ScheduledTask task = (ScheduledTask) (Consumer) RUN_HANDLE.get(taskObject); - if (task.getOwningPlugin() == plugin) count++; - } - } - - return count; - } - -} diff --git a/nms/v1_21_10/src/main/java/com/nisovin/magicspells/volatilecode/v1_21_10/VolatileGlowManager_v1_21_10.java b/nms/v1_21_10/src/main/java/com/nisovin/magicspells/volatilecode/v1_21_10/VolatileGlowManager_v1_21_10.java deleted file mode 100644 index 73546bc7f..000000000 --- a/nms/v1_21_10/src/main/java/com/nisovin/magicspells/volatilecode/v1_21_10/VolatileGlowManager_v1_21_10.java +++ /dev/null @@ -1,321 +0,0 @@ -package com.nisovin.magicspells.volatilecode.v1_21_10; - -import org.jetbrains.annotations.NotNull; - -import java.util.*; -import java.lang.invoke.MethodType; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; - -import io.netty.channel.ChannelPromise; -import io.netty.channel.ChannelPipeline; -import io.netty.channel.ChannelHandlerContext; -import io.netty.channel.ChannelOutboundHandlerAdapter; - -import net.minecraft.ChatFormatting; -import net.minecraft.network.protocol.Packet; -import net.minecraft.world.scores.PlayerTeam; -import net.minecraft.world.scores.Scoreboard; -import net.minecraft.util.StringRepresentable; -import net.minecraft.world.scores.Team.Visibility; -import net.minecraft.world.scores.Team.CollisionRule; -import net.minecraft.network.syncher.SynchedEntityData; -import net.minecraft.network.syncher.EntityDataAccessor; -import net.minecraft.network.syncher.EntityDataSerializers; -import net.minecraft.server.network.ServerGamePacketListenerImpl; -import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket; -import net.minecraft.network.protocol.game.ClientboundSetPlayerTeamPacket; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; -import org.bukkit.event.Listener; -import org.bukkit.scoreboard.Team; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.craftbukkit.entity.CraftEntity; -import org.bukkit.craftbukkit.entity.CraftPlayer; -import org.bukkit.configuration.ConfigurationSection; - -import com.nisovin.magicspells.util.glow.LibsDisguiseHelper; -import com.nisovin.magicspells.volatilecode.VolatileCodeHelper; -import com.nisovin.magicspells.util.glow.PacketBasedGlowManager; - -public class VolatileGlowManager_v1_21_10 extends PacketBasedGlowManager, ClientboundSetEntityDataPacket, ClientboundSetPlayerTeamPacket> { - - private static final EntityDataAccessor DATA_SHARED_FLAGS_ID = new EntityDataAccessor<>(0, EntityDataSerializers.BYTE); - - private final Set> handled = Collections.synchronizedSet(Collections.newSetFromMap(new WeakHashMap<>())); - private final MethodHandle teamPacketHandle; - private final VolatileCodeHelper helper; - - public VolatileGlowManager_v1_21_10(VolatileCodeHelper helper) { - this.helper = helper; - - try { - teamPacketHandle = MethodHandles - .privateLookupIn(ClientboundSetPlayerTeamPacket.class, MethodHandles.lookup()) - .findConstructor( - ClientboundSetPlayerTeamPacket.class, - MethodType.methodType(void.class, String.class, int.class, Optional.class, Collection.class) - ); - } catch (Exception e) { - throw new RuntimeException("Encountered an error while initializing VolatileGlowManagerLatest", e); - } - - helper.registerEvents(this); - } - - @Override - public void load() { - super.load(); - - Bukkit.getOnlinePlayers().forEach(this::addGlowChannelHandler); - } - - @Override - public synchronized void unload() { - Bukkit.getOnlinePlayers().forEach(this::removeGlowChannelHandler); - - super.unload(); - handled.clear(); - } - - @Override - protected Collection createAddTeamPackets() { - List teamPackets = new ArrayList<>(); - - ConfigurationSection config = helper.getMainConfig(); - boolean seeFriendlyInvisibles = config.getBoolean("general.glow-spell-scoreboard-teams.see-friendly-invisibles", false); - CollisionRule collision = getStringOption("collision-rule", CollisionRule.ALWAYS, StringRepresentable.createNameLookup(CollisionRule.values()), config, helper::error); - Visibility visibility = getStringOption("name-tag-visibility", Visibility.ALWAYS, StringRepresentable.createNameLookup(Visibility.values()), config, helper::error); - - Scoreboard scoreboard = new Scoreboard(); - for (ChatFormatting formatting : ChatFormatting.values()) { - if (!formatting.isColor()) continue; - - PlayerTeam team = new PlayerTeam(scoreboard, "magicspells:" + formatting.getName()); - team.setSeeFriendlyInvisibles(seeFriendlyInvisibles); - team.setNameTagVisibility(visibility); - team.setCollisionRule(collision); - team.setColor(formatting); - - teamPackets.add(ClientboundSetPlayerTeamPacket.createAddOrModifyPacket(team, true)); - } - - return teamPackets; - } - - @Override - protected Collection createRemoveTeamPackets() { - List packets = new ArrayList<>(); - - Scoreboard scoreboard = new Scoreboard(); - for (ChatFormatting formatting : ChatFormatting.values()) { - if (!formatting.isColor()) continue; - - PlayerTeam team = new PlayerTeam(scoreboard, "magicspells:" + formatting.getName()); - packets.add(ClientboundSetPlayerTeamPacket.createRemovePacket(team)); - } - - return packets; - } - - @Override - protected ClientboundSetEntityDataPacket createEntityDataPacket(@NotNull Entity entity, boolean forceGlow) { - byte metadata = ((CraftEntity) entity).getHandle().getEntityData().get(DATA_SHARED_FLAGS_ID); - if (forceGlow) metadata |= 0x40; - - return new ClientboundSetEntityDataPacket( - entity.getEntityId(), - list(new SynchedEntityData.DataValue<>( - 0, - EntityDataSerializers.BYTE, - metadata - )) - ); - } - - @Override - protected Collection createJoinTeamPacket(@NotNull GlowData data) { - return data.lastScoreboardEntry().map(entry -> { - try { - return (ClientboundSetPlayerTeamPacket) teamPacketHandle.invoke( - "magicspells:" + data.color(), - 3, - Optional.empty(), - list(entry) - ); - } catch (Throwable e) { - throw new RuntimeException(e); - } - }); - } - - @Override - protected Collection createResetTeamPacket(org.bukkit.scoreboard.@NotNull Scoreboard scoreboard, @NotNull GlowData data) { - return data.lastScoreboardEntry().map(entry -> { - try { - Team team = scoreboard.getEntryTeam(entry); - if (team != null) { - return (ClientboundSetPlayerTeamPacket) teamPacketHandle.invoke( - team.getName(), - 3, - Optional.empty(), - list(entry) - ); - } - - return (ClientboundSetPlayerTeamPacket) teamPacketHandle.invoke( - "magicspells:" + data.color(), - 4, - Optional.empty(), - list(entry) - ); - } catch (Throwable e) { - throw new RuntimeException(e); - } - }); - } - - @Override - protected void sendPacket(@NotNull Player player, @NotNull Packet packet) { - if (!(packet instanceof ClientboundSetPlayerTeamPacket teamPacket) || teamPacket.getTeamAction() == null) - handled.add(packet); - - ServerGamePacketListenerImpl connection = ((CraftPlayer) player).getHandle().connection; - connection.send(packet); - } - - @Override - protected void registerEvents(Listener listener) { - helper.registerEvents(listener); - } - - @Override - protected void cancelTask(int taskId) { - helper.cancelTask(taskId); - } - - @Override - public int scheduleDelayedTask(Runnable runnable, long delay) { - return helper.scheduleDelayedTask(runnable, delay); - } - - private void addGlowChannelHandler(Player player) { - ChannelPipeline pipeline = ((CraftPlayer) player).getHandle().connection.connection.channel.pipeline(); - pipeline.addBefore("unbundler", "magicspells:glow_channel_handler", new GlowChannelHandler(player)); - } - - private void removeGlowChannelHandler(Player player) { - ChannelPipeline pipeline = ((CraftPlayer) player).getHandle().connection.connection.channel.pipeline(); - - if (pipeline.get("magicspells:glow_channel_handler") != null) - pipeline.remove("magicspells:glow_channel_handler"); - } - - private List list(T element) { - List list = new ArrayList<>(1); - list.add(element); - - return list; - } - - @Override - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) { - super.onPlayerJoin(event); - addGlowChannelHandler(event.getPlayer()); - } - - @EventHandler - public void onPlayerQuit(PlayerQuitEvent event) { - removeGlowChannelHandler(event.getPlayer()); - } - - private class GlowChannelHandler extends ChannelOutboundHandlerAdapter { - - private final Player player; - - private GlowChannelHandler(Player player) { - this.player = player; - } - - @Override - public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { - if (msg instanceof Packet p && handled.contains(p)) { - super.write(ctx, msg, promise); - return; - } - - synchronized (VolatileGlowManager_v1_21_10.this) { - if (glows.isEmpty() && perPlayerGlows.isEmpty()) { - super.write(ctx, msg, promise); - return; - } - } - - switch (msg) { - case ClientboundSetEntityDataPacket packet -> handleEntityData(packet); - case ClientboundSetPlayerTeamPacket packet -> { - msg = handleTeamPacket(packet); - if (msg == null) return; - } - default -> {} - } - - super.write(ctx, msg, promise); - } - - private void handleEntityData(ClientboundSetEntityDataPacket packet) { - List> packedItems = packet.packedItems(); - if (packedItems.isEmpty()) return; - - SynchedEntityData.DataValue item = packedItems.getFirst(); - if (item.id() != 0) return; - - byte flags = (byte) item.value(); - if ((flags & 0x40) > 0) return; - - UUID uuid; - if (!libsDisguisesLoaded || packet.id() != LibsDisguiseHelper.getSelfDisguiseId()) { - var entity = ((CraftPlayer) player).getHandle().level().moonrise$getEntityLookup().get(packet.id()); - if (entity == null) return; - - uuid = entity.getUUID(); - } else uuid = player.getUniqueId(); - - GlowData data = getGlowData(player.getUniqueId(), uuid); - if (data == null) return; - - flags |= 0x40; - packedItems.set(0, new SynchedEntityData.DataValue<>(0, EntityDataSerializers.BYTE, flags)); - } - - private ClientboundSetPlayerTeamPacket handleTeamPacket(ClientboundSetPlayerTeamPacket packet) { - ClientboundSetPlayerTeamPacket.Action playerAction = packet.getPlayerAction(); - if (playerAction == null || packet.getTeamAction() != null) return packet; - - Collection entries = packet.getPlayers(); - if (entries.isEmpty()) return packet; - - Collection filtered = filterTeamEntries(player, entries); - if (filtered == null) return packet; - if (filtered.isEmpty()) return null; - - try { - return (ClientboundSetPlayerTeamPacket) teamPacketHandle.invoke( - packet.getName(), - playerAction == ClientboundSetPlayerTeamPacket.Action.ADD ? 3 : 4, - packet.getParameters(), - filtered - ); - } catch (Throwable e) { - throw new RuntimeException(e); - } - } - - } - -} diff --git a/settings.gradle.kts b/settings.gradle.kts index be5c6c4d9..7d86ea860 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -9,7 +9,6 @@ include("towny") include(":nms:shared") include(":nms:latest") -include(":nms:v1_21_10") pluginManagement { repositories { diff --git a/shop/build.gradle b/shop/build.gradle index b581d17f6..ded17733e 100644 --- a/shop/build.gradle +++ b/shop/build.gradle @@ -1,6 +1,6 @@ dependencies { implementation project(":core") - implementation("org.incendo:cloud-paper:2.0.0-beta.13") + implementation("org.incendo:cloud-paper:2.0.0-beta.14") implementation("net.milkbowl.vault:VaultAPI:1.7") { transitive = false } } From 2e18f31c1ba32bda5fd582ac8b169631c53f98a1 Mon Sep 17 00:00:00 2001 From: JasperLorelai Date: Sun, 5 Apr 2026 21:33:02 +0200 Subject: [PATCH 2/3] refactor: Remove old XGlow GlowSpell --- NOTICE.md | 4 - core/build.gradle | 4 - .../spells/targeted/ext/GlowSpell.java | 198 ------------------ core/src/main/resources/plugin.yml | 1 - 4 files changed, 207 deletions(-) delete mode 100644 core/src/main/java/com/nisovin/magicspells/spells/targeted/ext/GlowSpell.java diff --git a/NOTICE.md b/NOTICE.md index 944630f67..6319db052 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -55,10 +55,6 @@ The project includes software developed by third parties. For their full license - Licensed by: **sk89q, WorldEdit team and contributors** - License: **General Public License v3.0** (See `3rd_party_licenses/LICENSE-GPLv3`) -- XGlow: - - Repository: `Xezard/XGlow` - - License: **Apache-2.0 License** (See `3rd_party_licenses/LICENSE-Apache_v2`) - - packetevents: - Repository: `retrooper/packetevents` - License: **General Public License v3.0** (See `3rd_party_licenses/LICENSE-GPLv3`) diff --git a/core/build.gradle b/core/build.gradle index 644b9dc63..430d3ec49 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -25,10 +25,6 @@ dependencies { implementation("net.milkbowl.vault:VaultAPI:1.7") { transitive = false } implementation("me.clip:placeholderapi:2.12.2") { transitive = false } implementation("com.github.GriefPrevention:GriefPrevention:18.0.0") { transitive = false } - implementation("com.github.Xezard:XGlow:1.1.0") { - exclude(module: "XGlowPlugin") - exclude(module: "XGlowExample") - } implementation("com.sk89q.worldguard:worldguard-core:7.1.0-SNAPSHOT") { transitive = false } implementation("com.sk89q.worldguard:worldguard-bukkit:7.1.0-SNAPSHOT") { transitive = false } implementation("com.sk89q.worldedit:worldedit-core:7.4.0-SNAPSHOT") { transitive = false } diff --git a/core/src/main/java/com/nisovin/magicspells/spells/targeted/ext/GlowSpell.java b/core/src/main/java/com/nisovin/magicspells/spells/targeted/ext/GlowSpell.java deleted file mode 100644 index 9c586fe4a..000000000 --- a/core/src/main/java/com/nisovin/magicspells/spells/targeted/ext/GlowSpell.java +++ /dev/null @@ -1,198 +0,0 @@ -package com.nisovin.magicspells.spells.targeted.ext; - -import java.util.Set; -import java.util.UUID; -import java.util.Collection; - -import com.google.common.collect.Multimap; -import com.google.common.collect.LinkedListMultimap; - -import org.bukkit.ChatColor; -import org.bukkit.entity.Player; -import org.bukkit.entity.LivingEntity; - -import ru.xezard.glow.data.glow.Glow; - -import com.nisovin.magicspells.util.*; -import com.nisovin.magicspells.MagicSpells; -import com.nisovin.magicspells.spells.BuffSpell; -import com.nisovin.magicspells.spells.TargetedSpell; -import com.nisovin.magicspells.util.config.ConfigData; -import com.nisovin.magicspells.spells.TargetedEntitySpell; -import com.nisovin.magicspells.spells.buff.InvisibilitySpell; - -// XGlow: https://github.com/Xezard/XGlow -@DependsOn({"ProtocolLib", "XGlow"}) -public class GlowSpell extends TargetedSpell implements TargetedEntitySpell { - - private static final DeprecationNotice DEPRECATION_NOTICE = new DeprecationNotice( - "The '.targeted.ext.GlowSpell' spell class does not function, as the XGlow plugin is abandoned.", - "Use the '.targeted.GlowSpell' spell class." - ); - - private final Multimap glowing; - - private final ConfigData color; - - private final ConfigData duration; - - private final ConfigData powerAffectsDuration; - - public GlowSpell(MagicConfig config, String spellName) { - super(config, spellName); - - glowing = LinkedListMultimap.create(); - - duration = getConfigDataInt("duration", 0); - - powerAffectsDuration = getConfigDataBoolean("power-affects-duration", true); - - color = getConfigDataEnum("color", ChatColor.class, ChatColor.WHITE); - - MagicSpells.getDeprecationManager().addDeprecation(this, DEPRECATION_NOTICE); - } - - @Override - public CastResult cast(SpellData data) { - if (!(data.caster() instanceof Player caster)) return new CastResult(PostCastAction.ALREADY_HANDLED, data); - - TargetInfo info = getTargetedEntity(data); - if (info.noTarget()) return noTarget(info); - data = info.spellData(); - - glow(caster, data); - return new CastResult(PostCastAction.HANDLE_NORMALLY, data); - } - - @Override - public CastResult castAtEntity(SpellData data) { - if (!(data.caster() instanceof Player caster)) return new CastResult(PostCastAction.ALREADY_HANDLED, data); - - glow(caster, data); - return new CastResult(PostCastAction.HANDLE_NORMALLY, data); - } - - @Override - public void turnOff() { - glowing.values().forEach(glowData -> glowData.getGlow().destroy()); - } - - private void glow(Player caster, SpellData data) { - int duration = this.duration.get(data); - if (powerAffectsDuration.get(data)) duration = Math.round(duration * data.power()); - - LivingEntity target = data.target(); - - Collection glows = glowing.get(caster.getUniqueId()); - for (GlowData glowData : glows) { - // That entity is glowing for the caster - if (!glowData.getGlow().hasHolder(target)) continue; - - // If casted by the same spell, extend duration, otherwise fail - if (!glowData.getInternalName().equals(internalName)) return; - - MagicSpells.cancelTask(glowData.getTaskId()); - glowData.setTaskId(MagicSpells.scheduleDelayedTask(() -> { - // Make the target hidden if it has an invisibility spell active - if (target instanceof Player targetPlayer) { - Set buffSpells = MagicSpells.getBuffManager().getActiveBuffs(target); - if (buffSpells != null) { - for (BuffSpell buffSpell : buffSpells) { - if (!(buffSpell instanceof InvisibilitySpell)) continue; - if (!caster.canSee(targetPlayer)) continue; - - caster.hidePlayer(MagicSpells.getInstance(), targetPlayer); - } - } - } - - glowData.getGlow().destroy(); - glowing.remove(caster.getUniqueId(), glowData); - }, duration)); - - return; - } - - GlowData glowData; - - String name = target.getUniqueId() + caster.getUniqueId().toString() + internalName; - ChatColor color = this.color.get(data); - - Glow glow = new Glow(color, name); - glow.addHolders(target); - glow.display(caster); - - glowData = new GlowData(glow, internalName); - glowData.setTaskId(MagicSpells.scheduleDelayedTask(() -> { - // Make the target hidden if it has an invisibility spell active - if (target instanceof Player targetPlayer) { - Set buffSpells = MagicSpells.getBuffManager().getActiveBuffs(targetPlayer); - if (buffSpells != null) { - for (BuffSpell buffSpell : buffSpells) { - if (!(buffSpell instanceof InvisibilitySpell)) continue; - if (!caster.canSee(targetPlayer)) continue; - - caster.hidePlayer(MagicSpells.getInstance(), targetPlayer); - } - } - } - - glow.destroy(); - glowing.remove(caster.getUniqueId(), glowData); - }, duration)); - - // If target is a vanished player, make the caster see the target with vanish - if (target instanceof Player targetPlayer) { - Set buffSpells = MagicSpells.getBuffManager().getActiveBuffs(targetPlayer); - if (buffSpells != null) { - for (BuffSpell buffSpell : buffSpells) { - if (!(buffSpell instanceof InvisibilitySpell)) continue; - if (caster.canSee(targetPlayer)) continue; - - caster.showPlayer(MagicSpells.getInstance(), targetPlayer); - } - } - } - - glowing.put(caster.getUniqueId(), glowData); - playSpellEffects(data); - } - - private static class GlowData { - - private Glow glow; - private int taskId; - private String internalName; - - private GlowData(Glow glow, String internalName) { - this.glow = glow; - this.internalName = internalName; - } - - public Glow getGlow() { - return glow; - } - - public void setGlow(Glow glow) { - this.glow = glow; - } - - public int getTaskId() { - return taskId; - } - - public void setTaskId(int taskId) { - this.taskId = taskId; - } - - public String getInternalName() { - return internalName; - } - - public void setInternalName(String internalName) { - this.internalName = internalName; - } - - } - -} diff --git a/core/src/main/resources/plugin.yml b/core/src/main/resources/plugin.yml index 07e77a5bf..e2f9bec84 100644 --- a/core/src/main/resources/plugin.yml +++ b/core/src/main/resources/plugin.yml @@ -12,5 +12,4 @@ softdepend: - LibsDisguises - NoCheatPlus - PlaceholderAPI - - XGlow - packetevents From 8a45bca455bfcc3f561e6667d89f63282b6af9d4 Mon Sep 17 00:00:00 2001 From: JasperLorelai Date: Mon, 6 Apr 2026 02:47:08 +0200 Subject: [PATCH 3/3] chore: Fix deprecations --- core/src/main/resources/spells-regular.yml | 29 ++++------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/core/src/main/resources/spells-regular.yml b/core/src/main/resources/spells-regular.yml index 128689235..9400ba353 100644 --- a/core/src/main/resources/spells-regular.yml +++ b/core/src/main/resources/spells-regular.yml @@ -265,12 +265,11 @@ drainlife: cast-item: blaze_rod cooldown: 5 range: 15 - take-type: health + take-type: health_points take-amt: 2 - give-type: health + give-type: health_points give-amt: 2 animation-speed: 2 - ignore-armor: false instant: false can-target: players,monsters check-plugins: true @@ -778,27 +777,9 @@ invisibility: invulnerability: spell-class: ".buff.InvulnerabilitySpell" - description: Makes you invulnerable to damage. + description: Makes you invulnerable to damage as if you were in the Creative gamemode. cast-item: book - damage-causes: - - block explosion - - contact - - custom - - drowning - - entity attack - - entity explosion - - fall - - fire - - fire tick - - lava - - lightning - - magic - - poison - - projectile - - starvation - - suffocation - - void - - wither + damage-types: "!#minecraft:bypasses_invulnerability" duration: 60 cooldown: 300 cost: [mana 30] @@ -1112,7 +1093,7 @@ safefall: description: Allows you to fall without taking damage. cast-item: book cooldown: 60 - damage-causes: [fall] + damage-types: [fall] duration: 300 num-uses: 5 cost: [mana 20]