From 3491ff6be31a757d9b733b0cc27ffc66a61c4818 Mon Sep 17 00:00:00 2001 From: RedstoneFuture Date: Sat, 12 Oct 2024 20:48:47 +0200 Subject: [PATCH 1/9] Adding "windcharge" flag (1.21.1+) --- .../plotsquared/bukkit/BukkitPlatform.java | 4 ++ .../listener/EntityEventListener1211.java | 58 +++++++++++++++++++ .../core/plot/flag/GlobalFlagContainer.java | 2 + .../flag/implementations/WindChargeFlag.java | 39 +++++++++++++ Core/src/main/resources/lang/messages_en.json | 1 + 5 files changed, 104 insertions(+) create mode 100644 Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener1211.java create mode 100644 Core/src/main/java/com/plotsquared/core/plot/flag/implementations/WindChargeFlag.java diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java index 0ed057e394..3073a3e98c 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java @@ -33,6 +33,7 @@ import com.plotsquared.bukkit.listener.BlockEventListener117; import com.plotsquared.bukkit.listener.ChunkListener; import com.plotsquared.bukkit.listener.EntityEventListener; +import com.plotsquared.bukkit.listener.EntityEventListener1211; import com.plotsquared.bukkit.listener.EntitySpawnListener; import com.plotsquared.bukkit.listener.HighFreqBlockEventListener; import com.plotsquared.bukkit.listener.PaperListener; @@ -359,6 +360,9 @@ public void onEnable() { if (Settings.Enabled_Components.EVENTS) { getServer().getPluginManager().registerEvents(injector().getInstance(PlayerEventListener.class), this); + if ((serverVersion()[1] == 21 && serverVersion()[2] >= 1) || serverVersion()[1] > 21) { + getServer().getPluginManager().registerEvents(injector().getInstance(EntityEventListener1211.class), this); + } if ((serverVersion()[1] == 20 && serverVersion()[2] >= 1) || serverVersion()[1] > 20) { getServer().getPluginManager().registerEvents(injector().getInstance(PlayerEventListener1201.class), this); } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener1211.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener1211.java new file mode 100644 index 0000000000..c758da6d22 --- /dev/null +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener1211.java @@ -0,0 +1,58 @@ +/* + * PlotSquared, a land and world management plugin for Minecraft. + * Copyright (C) IntellectualSites + * Copyright (C) IntellectualSites team and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.plotsquared.bukkit.listener; + +import com.plotsquared.bukkit.util.BukkitUtil; +import com.plotsquared.core.location.Location; +import com.plotsquared.core.plot.Plot; +import com.plotsquared.core.plot.PlotArea; +import com.plotsquared.core.plot.flag.implementations.WindChargeFlag; +import com.plotsquared.core.util.PlotFlagUtil; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityExplodeEvent; + +/** + * For events since 1.21.1 + * @since TODO + */ +public class EntityEventListener1211 implements Listener { + + @EventHandler(ignoreCancelled = true) + public void onWindCharge(EntityExplodeEvent event) { + // TODO Use "ExplosionResult" for this check after building the plugin with 1.21.1+ + Location location = BukkitUtil.adapt(event.getEntity().getLocation()); + PlotArea area = location.getPlotArea(); + if (area == null) { + return; + } + Plot plot = location.getOwnedPlot(); + if (plot == null) { + if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, WindChargeFlag.class, false)) { + event.setCancelled(true); + } + return; + } + if (!plot.getFlag(WindChargeFlag.class)) { + plot.debug("Could not update blocks by wind charge because wind-charge = false"); + event.setCancelled(true); + } + } + +} diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/GlobalFlagContainer.java b/Core/src/main/java/com/plotsquared/core/plot/flag/GlobalFlagContainer.java index bff2b0c8b8..7b92dadcfd 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/GlobalFlagContainer.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/GlobalFlagContainer.java @@ -92,6 +92,7 @@ import com.plotsquared.core.plot.flag.implementations.PriceFlag; import com.plotsquared.core.plot.flag.implementations.ProjectileChangeBlockFlag; import com.plotsquared.core.plot.flag.implementations.ProjectilesFlag; +import com.plotsquared.core.plot.flag.implementations.WindChargeFlag; import com.plotsquared.core.plot.flag.implementations.PveFlag; import com.plotsquared.core.plot.flag.implementations.PvpFlag; import com.plotsquared.core.plot.flag.implementations.RedstoneFlag; @@ -207,6 +208,7 @@ private GlobalFlagContainer() { this.addFlag(VillagerInteractFlag.VILLAGER_INTERACT_FALSE); this.addFlag(VineGrowFlag.VINE_GROW_TRUE); this.addFlag(ProjectilesFlag.PROJECTILES_FALSE); + this.addFlag(WindChargeFlag.WIND_CHARGE_FALSE); // Double flags this.addFlag(PriceFlag.PRICE_NOT_BUYABLE); diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/WindChargeFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/WindChargeFlag.java new file mode 100644 index 0000000000..4f3f2cfb21 --- /dev/null +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/WindChargeFlag.java @@ -0,0 +1,39 @@ +/* + * PlotSquared, a land and world management plugin for Minecraft. + * Copyright (C) IntellectualSites + * Copyright (C) IntellectualSites team and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.plotsquared.core.plot.flag.implementations; + +import com.plotsquared.core.configuration.caption.TranslatableCaption; +import com.plotsquared.core.plot.flag.types.BooleanFlag; +import org.checkerframework.checker.nullness.qual.NonNull; + +public class WindChargeFlag extends BooleanFlag { + + public static final WindChargeFlag WIND_CHARGE_TRUE = new WindChargeFlag(true); + public static final WindChargeFlag WIND_CHARGE_FALSE = new WindChargeFlag(false); + + private WindChargeFlag(boolean value) { + super(value, TranslatableCaption.of("flags.flag_description_windcharge")); + } + + @Override + protected WindChargeFlag flagOf(@NonNull Boolean value) { + return value ? WIND_CHARGE_TRUE : WIND_CHARGE_FALSE; + } + +} diff --git a/Core/src/main/resources/lang/messages_en.json b/Core/src/main/resources/lang/messages_en.json index 5ea33d6a6f..f11cee5a49 100644 --- a/Core/src/main/resources/lang/messages_en.json +++ b/Core/src/main/resources/lang/messages_en.json @@ -629,6 +629,7 @@ "flags.flag_description_leaf_decay": "Set to `false` to prevent leaves from decaying.", "flags.flag_description_projectiles": "Prevents guests from shooting projectiles on the plot when set to false.", "flags.flag_description_beacon_effect": "Enables beacon effects on the plot.", + "flags.flag_description_windcharge": "Enables Wind-Charge effects on the plot.", "flags.flag_error_boolean": "Flag value must be a boolean (true | false).", "flags.flag_error_enum": "Must be one of: ", "flags.flag_error_integer": "Flag value must be a whole positive number.", From 5a6a0fa0f974166ae472609f762d732a2ab7b66a Mon Sep 17 00:00:00 2001 From: RedstoneFuture Date: Mon, 17 Feb 2025 23:44:29 +0100 Subject: [PATCH 2/9] Updating minecraft version support --- Bukkit/build.gradle.kts | 2 +- .../com/plotsquared/bukkit/listener/EntityEventListener.java | 4 ++-- .../com/plotsquared/bukkit/listener/EntitySpawnListener.java | 4 ++-- .../java/com/plotsquared/bukkit/listener/PaperListener.java | 4 ++-- .../plotsquared/bukkit/listener/ProjectileEventListener.java | 4 ++-- .../java/com/plotsquared/bukkit/util/BukkitEntityUtil.java | 2 +- gradle/libs.versions.toml | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Bukkit/build.gradle.kts b/Bukkit/build.gradle.kts index a254af9800..0971bce903 100644 --- a/Bukkit/build.gradle.kts +++ b/Bukkit/build.gradle.kts @@ -101,7 +101,7 @@ tasks { withType { val isRelease = if (rootProject.version.toString().endsWith("-SNAPSHOT")) "TODO" else rootProject.version.toString() val opt = options as StandardJavadocDocletOptions - opt.links("https://jd.papermc.io/paper/1.20/") + opt.links("https://jd.papermc.io/paper/1.21/") opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-bukkit/" + libs.worldeditBukkit.get().versionConstraint.toString()) opt.links("https://intellectualsites.github.io/plotsquared-javadocs/core/") opt.links("https://jd.advntr.dev/api/" + libs.adventureApi.get().versionConstraint.toString()) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java index 358c348dd3..120206c3cb 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java @@ -314,7 +314,7 @@ public void onBigBoom(EntityExplodeEvent event) { if (this.lastRadius != 0) { List nearby = event.getEntity().getNearbyEntities(this.lastRadius, this.lastRadius, this.lastRadius); for (Entity near : nearby) { - if (near instanceof TNTPrimed || near.getType().equals(EntityType.MINECART_TNT)) { + if (near instanceof TNTPrimed || near.getType().equals(EntityType.TNT_MINECART)) { if (!near.hasMetadata("plot")) { near.setMetadata("plot", new FixedMetadataValue((Plugin) PlotSquared.platform(), plot)); } @@ -338,7 +338,7 @@ public void onBigBoom(EntityExplodeEvent event) { event.setCancelled(true); //Spawn Explosion Particles when enabled in settings if (Settings.General.ALWAYS_SHOW_EXPLOSIONS) { - event.getLocation().getWorld().spawnParticle(Particle.EXPLOSION_HUGE, event.getLocation(), 0); + event.getLocation().getWorld().spawnParticle(Particle.EXPLOSION_EMITTER, event.getLocation(), 0); } } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java index 505fee01df..613329ea00 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java @@ -132,7 +132,7 @@ public void creatureSpawnEvent(EntitySpawnEvent event) { Plot plot = location.getOwnedPlotAbs(); EntityType type = entity.getType(); if (plot == null) { - if (type == EntityType.DROPPED_ITEM) { + if (type == EntityType.ITEM) { if (Settings.Enabled_Components.KILL_ROAD_ITEMS) { event.setCancelled(true); } @@ -154,7 +154,7 @@ public void creatureSpawnEvent(EntitySpawnEvent event) { if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) { event.setCancelled(true); } - if (type == EntityType.ENDER_CRYSTAL || type == EntityType.ARMOR_STAND) { + if (type == EntityType.END_CRYSTAL || type == EntityType.ARMOR_STAND) { if (BukkitEntityUtil.checkEntity(entity, plot)) { event.setCancelled(true); } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java index aa6474be17..b0c652929a 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java @@ -228,7 +228,7 @@ public void onPreCreatureSpawnEvent(PreCreatureSpawnEvent event) { if (plot == null) { EntityType type = event.getType(); // PreCreatureSpawnEvent **should** not be called for DROPPED_ITEM, just for the sake of consistency - if (type == EntityType.DROPPED_ITEM) { + if (type == EntityType.ITEM) { if (Settings.Enabled_Components.KILL_ROAD_ITEMS) { event.setCancelled(true); } @@ -354,7 +354,7 @@ public void onProjectileLaunch(PlayerLaunchProjectileEvent event) { event.setCancelled(true); } } else if (!plot.isAdded(pp.getUUID())) { - if (entity.getType().equals(EntityType.FISHING_HOOK)) { + if (entity.getType().equals(EntityType.FISHING_BOBBER)) { if (plot.getFlag(FishingFlag.class)) { return; } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileEventListener.java index 8c79b29d3c..6b0e80099c 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileEventListener.java @@ -134,7 +134,7 @@ public void onProjectileLaunch(ProjectileLaunchEvent event) { event.setCancelled(true); } } else if (!plot.isAdded(pp.getUUID())) { - if (entity.getType().equals(EntityType.FISHING_HOOK)) { + if (entity.getType().equals(EntityType.FISHING_BOBBER)) { if (plot.getFlag(FishingFlag.class)) { return; } @@ -194,7 +194,7 @@ public void onProjectileHit(ProjectileHitEvent event) { return; } if (plot.isAdded(pp.getUUID()) || pp.hasPermission(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER) || plot.getFlag( - ProjectilesFlag.class) || (entity.getType().equals(EntityType.FISHING_HOOK) && plot.getFlag( + ProjectilesFlag.class) || (entity.getType().equals(EntityType.FISHING_BOBBER) && plot.getFlag( FishingFlag.class))) { return; } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEntityUtil.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEntityUtil.java index becc3ddc1a..00a60163c6 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEntityUtil.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEntityUtil.java @@ -342,7 +342,7 @@ public static boolean entityDamage(Entity damager, Entity victim, EntityDamageEv //disable the firework damage. too much of a headache to support at the moment. if (vplot != null) { if (EntityDamageEvent.DamageCause.ENTITY_EXPLOSION == cause - && damager.getType() == EntityType.FIREWORK) { + && damager.getType() == EntityType.FIREWORK_ROCKET) { return false; } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5ef6a3b957..607fcaa672 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] # Platform expectations -paper = "1.20.4-R0.1-SNAPSHOT" +paper = "1.21.1-R0.1-SNAPSHOT" guice = "7.0.0" spotbugs = "4.9.1" checkerqual = "3.49.0" From d85b65824f7b48847c4bca48816a65c3ca21dd0e Mon Sep 17 00:00:00 2001 From: RedstoneFuture Date: Mon, 17 Feb 2025 23:46:07 +0100 Subject: [PATCH 3/9] Reworking event listener --- .../plotsquared/bukkit/BukkitPlatform.java | 4 +- ...11.java => ProjectileLaunchEvent1211.java} | 44 +++++++++++++++---- Core/src/main/resources/lang/messages_en.json | 2 +- 3 files changed, 39 insertions(+), 11 deletions(-) rename Bukkit/src/main/java/com/plotsquared/bukkit/listener/{EntityEventListener1211.java => ProjectileLaunchEvent1211.java} (57%) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java index 95df087ca8..b369a9d970 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java @@ -33,7 +33,7 @@ import com.plotsquared.bukkit.listener.BlockEventListener117; import com.plotsquared.bukkit.listener.ChunkListener; import com.plotsquared.bukkit.listener.EntityEventListener; -import com.plotsquared.bukkit.listener.EntityEventListener1211; +import com.plotsquared.bukkit.listener.ProjectileLaunchEvent1211; import com.plotsquared.bukkit.listener.EntitySpawnListener; import com.plotsquared.bukkit.listener.HighFreqBlockEventListener; import com.plotsquared.bukkit.listener.PaperListener; @@ -361,7 +361,7 @@ public void onEnable() { if (Settings.Enabled_Components.EVENTS) { getServer().getPluginManager().registerEvents(injector().getInstance(PlayerEventListener.class), this); if ((serverVersion()[1] == 21 && serverVersion()[2] >= 1) || serverVersion()[1] > 21) { - getServer().getPluginManager().registerEvents(injector().getInstance(EntityEventListener1211.class), this); + getServer().getPluginManager().registerEvents(injector().getInstance(ProjectileLaunchEvent1211.class), this); } if ((serverVersion()[1] == 20 && serverVersion()[2] >= 1) || serverVersion()[1] > 20) { getServer().getPluginManager().registerEvents(injector().getInstance(PlayerEventListener1201.class), this); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener1211.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileLaunchEvent1211.java similarity index 57% rename from Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener1211.java rename to Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileLaunchEvent1211.java index c758da6d22..f3509258a1 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener1211.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileLaunchEvent1211.java @@ -20,39 +20,67 @@ import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.core.location.Location; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.flag.implementations.WindChargeFlag; import com.plotsquared.core.util.PlotFlagUtil; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.entity.ProjectileLaunchEvent; +import org.bukkit.projectiles.ProjectileSource; /** * For events since 1.21.1 * @since TODO */ -public class EntityEventListener1211 implements Listener { - +public class ProjectileLaunchEvent1211 implements Listener { + @EventHandler(ignoreCancelled = true) - public void onWindCharge(EntityExplodeEvent event) { - // TODO Use "ExplosionResult" for this check after building the plugin with 1.21.1+ - Location location = BukkitUtil.adapt(event.getEntity().getLocation()); + public void onWindCharge(ProjectileLaunchEvent event) { + + Projectile entity = event.getEntity(); + if ((entity.getType() != EntityType.WIND_CHARGE) && (entity.getType() != EntityType.BREEZE_WIND_CHARGE)) { + return; + } + + ProjectileSource shooter = entity.getShooter(); + if (!(shooter instanceof Player)) { + return; + } + Location location = BukkitUtil.adapt(entity.getLocation()); PlotArea area = location.getPlotArea(); if (area == null) { return; } + PlotPlayer pp = BukkitUtil.adapt((Player) shooter); Plot plot = location.getOwnedPlot(); + if (plot == null) { if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, WindChargeFlag.class, false)) { + entity.remove(); event.setCancelled(true); } return; } - if (!plot.getFlag(WindChargeFlag.class)) { - plot.debug("Could not update blocks by wind charge because wind-charge = false"); + + if (!plot.hasOwner()) { + entity.remove(); event.setCancelled(true); + return; + } + + if (!plot.isAdded(pp.getUUID())) { + if (!plot.getFlag(WindChargeFlag.class)) { + plot.debug("Could not update blocks by wind charge because wind-charge = false"); + entity.remove(); + event.setCancelled(true); + } } + } } diff --git a/Core/src/main/resources/lang/messages_en.json b/Core/src/main/resources/lang/messages_en.json index 301e336a6c..d297dcb929 100644 --- a/Core/src/main/resources/lang/messages_en.json +++ b/Core/src/main/resources/lang/messages_en.json @@ -631,7 +631,7 @@ "flags.flag_description_projectiles": "Prevents guests from shooting projectiles on the plot when set to false.", "flags.flag_description_weaving_death_place": "Set to `false` to prevent spawning of cobwebs by the Weaving status effect on the death of an entity.", "flags.flag_description_beacon_effect": "Enables beacon effects on the plot.", - "flags.flag_description_windcharge": "Enables Wind-Charge effects on the plot.", + "flags.flag_description_windcharge": "Enables Wind-Charge interactions on the plot.", "flags.flag_error_boolean": "Flag value must be a boolean (true | false).", "flags.flag_error_enum": "Must be one of: ", "flags.flag_error_integer": "Flag value must be a whole positive number.", From 42d69073c585c2b1ee25192502c8e68b98ccd0fb Mon Sep 17 00:00:00 2001 From: RedstoneFuture Date: Mon, 17 Feb 2025 23:51:54 +0100 Subject: [PATCH 4/9] Small typo --- .../bukkit/listener/ProjectileLaunchEvent1211.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileLaunchEvent1211.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileLaunchEvent1211.java index f3509258a1..9cb38f35ee 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileLaunchEvent1211.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileLaunchEvent1211.java @@ -38,15 +38,15 @@ * @since TODO */ public class ProjectileLaunchEvent1211 implements Listener { - + @EventHandler(ignoreCancelled = true) public void onWindCharge(ProjectileLaunchEvent event) { - + Projectile entity = event.getEntity(); if ((entity.getType() != EntityType.WIND_CHARGE) && (entity.getType() != EntityType.BREEZE_WIND_CHARGE)) { return; } - + ProjectileSource shooter = entity.getShooter(); if (!(shooter instanceof Player)) { return; @@ -66,13 +66,13 @@ public void onWindCharge(ProjectileLaunchEvent event) { } return; } - + if (!plot.hasOwner()) { entity.remove(); event.setCancelled(true); return; } - + if (!plot.isAdded(pp.getUUID())) { if (!plot.getFlag(WindChargeFlag.class)) { plot.debug("Could not update blocks by wind charge because wind-charge = false"); @@ -80,7 +80,7 @@ public void onWindCharge(ProjectileLaunchEvent event) { event.setCancelled(true); } } - + } } From ae70e4de25f7d6133ce7132887880122f3d76850 Mon Sep 17 00:00:00 2001 From: RedstoneFuture Date: Tue, 18 Feb 2025 02:32:11 +0100 Subject: [PATCH 5/9] Fixing event-listener --- .../bukkit/listener/ProjectileLaunchEvent1211.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileLaunchEvent1211.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileLaunchEvent1211.java index 9cb38f35ee..8c64c1528e 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileLaunchEvent1211.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileLaunchEvent1211.java @@ -29,8 +29,9 @@ import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; -import org.bukkit.event.entity.ProjectileLaunchEvent; +import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.projectiles.ProjectileSource; /** @@ -39,8 +40,8 @@ */ public class ProjectileLaunchEvent1211 implements Listener { - @EventHandler(ignoreCancelled = true) - public void onWindCharge(ProjectileLaunchEvent event) { + @EventHandler(priority = EventPriority.HIGH) + public void onWindCharge(ProjectileHitEvent event) { Projectile entity = event.getEntity(); if ((entity.getType() != EntityType.WIND_CHARGE) && (entity.getType() != EntityType.BREEZE_WIND_CHARGE)) { From 90abed6c4fff4f8e6d74a52f5e67791ef4b53fd1 Mon Sep 17 00:00:00 2001 From: RedstoneFuture Date: Tue, 18 Feb 2025 03:04:16 +0100 Subject: [PATCH 6/9] Renaming event-listener class --- .../src/main/java/com/plotsquared/bukkit/BukkitPlatform.java | 4 ++-- ...eLaunchEvent1211.java => ProjectileEventListener1211.java} | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename Bukkit/src/main/java/com/plotsquared/bukkit/listener/{ProjectileLaunchEvent1211.java => ProjectileEventListener1211.java} (97%) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java index b369a9d970..826664cda6 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java @@ -33,7 +33,7 @@ import com.plotsquared.bukkit.listener.BlockEventListener117; import com.plotsquared.bukkit.listener.ChunkListener; import com.plotsquared.bukkit.listener.EntityEventListener; -import com.plotsquared.bukkit.listener.ProjectileLaunchEvent1211; +import com.plotsquared.bukkit.listener.ProjectileEventListener1211; import com.plotsquared.bukkit.listener.EntitySpawnListener; import com.plotsquared.bukkit.listener.HighFreqBlockEventListener; import com.plotsquared.bukkit.listener.PaperListener; @@ -361,7 +361,7 @@ public void onEnable() { if (Settings.Enabled_Components.EVENTS) { getServer().getPluginManager().registerEvents(injector().getInstance(PlayerEventListener.class), this); if ((serverVersion()[1] == 21 && serverVersion()[2] >= 1) || serverVersion()[1] > 21) { - getServer().getPluginManager().registerEvents(injector().getInstance(ProjectileLaunchEvent1211.class), this); + getServer().getPluginManager().registerEvents(injector().getInstance(ProjectileEventListener1211.class), this); } if ((serverVersion()[1] == 20 && serverVersion()[2] >= 1) || serverVersion()[1] > 20) { getServer().getPluginManager().registerEvents(injector().getInstance(PlayerEventListener1201.class), this); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileLaunchEvent1211.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileEventListener1211.java similarity index 97% rename from Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileLaunchEvent1211.java rename to Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileEventListener1211.java index 8c64c1528e..2a1553b95a 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileLaunchEvent1211.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileEventListener1211.java @@ -38,7 +38,7 @@ * For events since 1.21.1 * @since TODO */ -public class ProjectileLaunchEvent1211 implements Listener { +public class ProjectileEventListener1211 implements Listener { @EventHandler(priority = EventPriority.HIGH) public void onWindCharge(ProjectileHitEvent event) { From be3da72f92707b4416a7840e6ebf2c4fedc2d1dd Mon Sep 17 00:00:00 2001 From: RedstoneFuture Date: Sun, 15 Jun 2025 13:32:20 +0200 Subject: [PATCH 7/9] Fixing merge conflict: Usage of version secure particle query --- .../com/plotsquared/bukkit/listener/EntityEventListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java index f3af4f885e..1edf9f189f 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java @@ -347,7 +347,7 @@ public void onBigBoom(EntityExplodeEvent event) { event.setCancelled(true); //Spawn Explosion Particles when enabled in settings if (Settings.General.ALWAYS_SHOW_EXPLOSIONS) { - event.getLocation().getWorld().spawnParticle(Particle.EXPLOSION_EMITTER, event.getLocation(), 0); + event.getLocation().getWorld().spawnParticle(EXPLOSION_HUGE, event.getLocation(), 0); } } From 62b7ecff6198b56db43c5b42ef6dfdbf1f8e132f Mon Sep 17 00:00:00 2001 From: RedstoneFuture Date: Sun, 15 Jun 2025 13:37:40 +0200 Subject: [PATCH 8/9] Update PaperMC dependency link to 1.21.1 --- Bukkit/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bukkit/build.gradle.kts b/Bukkit/build.gradle.kts index 44a400e45d..e017319068 100644 --- a/Bukkit/build.gradle.kts +++ b/Bukkit/build.gradle.kts @@ -103,7 +103,7 @@ tasks { withType { val isRelease = if (rootProject.version.toString().endsWith("-SNAPSHOT")) "TODO" else rootProject.version.toString() val opt = options as StandardJavadocDocletOptions - opt.links("https://jd.papermc.io/paper/1.21/") + opt.links("https://jd.papermc.io/paper/1.21.1/") opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-bukkit/" + libs.worldeditBukkit.get().versionConstraint.toString()) opt.links("https://intellectualsites.github.io/plotsquared-javadocs/core/") opt.links("https://jd.advntr.dev/api/" + libs.adventureApi.get().versionConstraint.toString()) From 191224ed9d68c40b1cee41079288e482c7968a05 Mon Sep 17 00:00:00 2001 From: RedstoneFuture Date: Sat, 24 Jan 2026 15:28:17 +0100 Subject: [PATCH 9/9] Redoing comment out the dependency link --- Bukkit/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bukkit/build.gradle.kts b/Bukkit/build.gradle.kts index 98e1085de7..c8500b73ba 100644 --- a/Bukkit/build.gradle.kts +++ b/Bukkit/build.gradle.kts @@ -110,7 +110,7 @@ tasks { val isRelease = if (rootProject.version.toString().endsWith("-SNAPSHOT")) "TODO" else rootProject.version.toString() val opt = options as StandardJavadocDocletOptions opt.links("https://jd.papermc.io/paper/1.21.1/") - opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-bukkit/" + libs.worldeditBukkit.get().versionConstraint.toString()) +// opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-bukkit/" + libs.worldeditBukkit.get().versionConstraint.toString()) opt.links("https://intellectualsites.github.io/plotsquared-javadocs/core/") // opt.links("https://jd.advntr.dev/api/" + libs.adventureApi.get().versionConstraint.toString()) opt.links("https://google.github.io/guice/api-docs/" + libs.guice.get().versionConstraint.toString() + "/javadoc/")