* chore: bump api to 1.21.4

* fix: replace (removed) constants with backwards compatible alternatives

* chore: cleanup import

* chore: update javadoc link for paper

* chore: i like this more

* fix: check for vehicle

* chore: compile against 1.20.4 again

* chore: add 1.21.4 to bug report issue template

* chore: add 1.21.4 to runServer supported versions array

* chore: update entity type enum name switch

* chore: remove 1.18 from supportedVersions for runServer task

* fix: attempt to update ReplicatingEntityWrapper

* fix/chore: missing boat handling on spawn

* chore: cleanup imports
This commit is contained in:
Pierre Maurice Schwang 2025-02-23 11:20:33 +01:00 committed by GitHub
parent 4e2ea67992
commit d4f10422e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 88 additions and 48 deletions

View File

@ -27,6 +27,7 @@ body:
description: Which server version are you using? If your server version is not listed, it is not supported. Update to a supported version first. description: Which server version are you using? If your server version is not listed, it is not supported. Update to a supported version first.
multiple: false multiple: false
options: options:
- '1.21.4'
- '1.21.3' - '1.21.3'
- '1.21.1' - '1.21.1'
- '1.20.6' - '1.20.6'

View File

@ -39,7 +39,9 @@ dependencies {
} }
compileOnly(libs.placeholderapi) compileOnly(libs.placeholderapi)
compileOnly(libs.luckperms) compileOnly(libs.luckperms)
compileOnly(libs.essentialsx) compileOnly(libs.essentialsx) {
exclude(group = "org.spigotmc")
}
compileOnly(libs.mvdwapi) { isTransitive = false } compileOnly(libs.mvdwapi) { isTransitive = false }
// Other libraries // Other libraries
@ -101,7 +103,7 @@ tasks {
withType<Javadoc> { withType<Javadoc> {
val isRelease = if (rootProject.version.toString().endsWith("-SNAPSHOT")) "TODO" else rootProject.version.toString() val isRelease = if (rootProject.version.toString().endsWith("-SNAPSHOT")) "TODO" else rootProject.version.toString()
val opt = options as StandardJavadocDocletOptions val opt = options as StandardJavadocDocletOptions
opt.links("https://jd.papermc.io/paper/1.20/") opt.links("https://jd.papermc.io/paper/1.20.4/")
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://intellectualsites.github.io/plotsquared-javadocs/core/")
opt.links("https://jd.advntr.dev/api/" + libs.adventureApi.get().versionConstraint.toString()) opt.links("https://jd.advntr.dev/api/" + libs.adventureApi.get().versionConstraint.toString())

View File

@ -789,22 +789,23 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
if (entity.getMetadata("ps_custom_spawned").stream().anyMatch(MetadataValue::asBoolean)) { if (entity.getMetadata("ps_custom_spawned").stream().anyMatch(MetadataValue::asBoolean)) {
continue; continue;
} }
// TODO: use (type) pattern matching when targeting java 21
switch (entity.getType().toString()) { switch (entity.getType().toString()) {
case "EGG": case "EGG":
case "FISHING_HOOK": case "FISHING_HOOK", "FISHING_BOBBER":
case "ENDER_SIGNAL": case "ENDER_SIGNAL", "EYE_OF_ENDER":
case "AREA_EFFECT_CLOUD": case "AREA_EFFECT_CLOUD":
case "EXPERIENCE_ORB": case "EXPERIENCE_ORB":
case "LEASH_HITCH": case "LEASH_HITCH", "LEASH_KNOT":
case "FIREWORK": case "FIREWORK", "FIREWORK_ROCKET":
case "LIGHTNING": case "LIGHTNING", "LIGHTNING_BOLT":
case "WITHER_SKULL": case "WITHER_SKULL":
case "UNKNOWN": case "UNKNOWN":
case "PLAYER": case "PLAYER":
// non moving / unmovable // non moving / unmovable
continue; continue;
case "THROWN_EXP_BOTTLE": case "THROWN_EXP_BOTTLE", "EXPERIENCE_BOTTLE":
case "SPLASH_POTION": case "SPLASH_POTION", "POTION":
case "SNOWBALL": case "SNOWBALL":
case "SHULKER_BULLET": case "SHULKER_BULLET":
case "SPECTRAL_ARROW": case "SPECTRAL_ARROW":
@ -836,6 +837,11 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
case "TNT_MINECART": case "TNT_MINECART":
case "CHEST_BOAT": case "CHEST_BOAT":
case "BOAT": case "BOAT":
case "ACACIA_BOAT", "BIRCH_BOAT", "CHERRY_BOAT", "DARK_OAK_BOAT", "JUNGLE_BOAT", "MANGROVE_BOAT",
"OAK_BOAT", "PALE_OAK_BOAT", "SPRUCE_BOAT", "BAMBOO_RAFT":
case "ACACIA_CHEST_BOAT", "BIRCH_CHEST_BOAT", "CHERRY_CHEST_BOAT", "DARK_OAK_CHEST_BOAT",
"JUNGLE_CHEST_BOAT", "MANGROVE_CHEST_BOAT", "OAK_CHEST_BOAT", "PALE_OAK_CHEST_BOAT",
"SPRUCE_CHEST_BOAT", "BAMBOO_CHEST_RAFT":
if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) { if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
com.plotsquared.core.location.Location location = BukkitUtil.adapt(entity.getLocation()); com.plotsquared.core.location.Location location = BukkitUtil.adapt(entity.getLocation());
Plot plot = location.getPlot(); Plot plot = location.getPlot();
@ -864,14 +870,14 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
case "SMALL_FIREBALL": case "SMALL_FIREBALL":
case "FIREBALL": case "FIREBALL":
case "DRAGON_FIREBALL": case "DRAGON_FIREBALL":
case "DROPPED_ITEM": case "DROPPED_ITEM", "ITEM":
if (Settings.Enabled_Components.KILL_ROAD_ITEMS if (Settings.Enabled_Components.KILL_ROAD_ITEMS
&& plotArea.getOwnedPlotAbs(BukkitUtil.adapt(entity.getLocation())) == null) { && plotArea.getOwnedPlotAbs(BukkitUtil.adapt(entity.getLocation())) == null) {
this.removeRoadEntity(entity, iterator); this.removeRoadEntity(entity, iterator);
} }
// dropped item // dropped item
continue; continue;
case "PRIMED_TNT": case "PRIMED_TNT", "TNT":
case "FALLING_BLOCK": case "FALLING_BLOCK":
// managed elsewhere // managed elsewhere
continue; continue;
@ -949,7 +955,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
case "HORSE": case "HORSE":
case "IRON_GOLEM": case "IRON_GOLEM":
case "MAGMA_CUBE": case "MAGMA_CUBE":
case "MUSHROOM_COW": case "MUSHROOM_COW", "MOOSHROOM":
case "OCELOT": case "OCELOT":
case "PIG": case "PIG":
case "PIG_ZOMBIE": case "PIG_ZOMBIE":
@ -958,7 +964,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
case "SILVERFISH": case "SILVERFISH":
case "SKELETON": case "SKELETON":
case "SLIME": case "SLIME":
case "SNOWMAN": case "SNOWMAN", "SNOW_GOLEM":
case "SPIDER": case "SPIDER":
case "SQUID": case "SQUID":
case "VILLAGER": case "VILLAGER":

View File

@ -25,7 +25,6 @@ import org.bukkit.Art;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Rotation; import org.bukkit.Rotation;
import org.bukkit.TreeSpecies;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.entity.AbstractHorse; import org.bukkit.entity.AbstractHorse;
@ -34,6 +33,7 @@ import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Bat; import org.bukkit.entity.Bat;
import org.bukkit.entity.Boat; import org.bukkit.entity.Boat;
import org.bukkit.entity.Breedable; import org.bukkit.entity.Breedable;
import org.bukkit.entity.ChestBoat;
import org.bukkit.entity.ChestedHorse; import org.bukkit.entity.ChestedHorse;
import org.bukkit.entity.EnderDragon; import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -44,7 +44,6 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Painting; import org.bukkit.entity.Painting;
import org.bukkit.entity.Rabbit; import org.bukkit.entity.Rabbit;
import org.bukkit.entity.Sheep; import org.bukkit.entity.Sheep;
import org.bukkit.entity.Slime;
import org.bukkit.entity.Tameable; import org.bukkit.entity.Tameable;
import org.bukkit.inventory.EntityEquipment; import org.bukkit.inventory.EntityEquipment;
import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.InventoryHolder;
@ -103,11 +102,19 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
this.noGravity = true; this.noGravity = true;
} }
switch (entity.getType().toString()) { switch (entity.getType().toString()) {
case "BOAT" -> { case "BOAT", "ACACIA_BOAT", "BIRCH_BOAT", "CHERRY_BOAT", "DARK_OAK_BOAT", "JUNGLE_BOAT", "MANGROVE_BOAT",
"OAK_BOAT", "PALE_OAK_BOAT", "SPRUCE_BOAT", "BAMBOO_RAFT" -> {
Boat boat = (Boat) entity; Boat boat = (Boat) entity;
this.dataByte = getOrdinal(TreeSpecies.values(), boat.getWoodType()); this.dataByte = getOrdinal(Boat.Type.values(), boat.getBoatType());
return; return;
} }
case "ACACIA_CHEST_BOAT", "BIRCH_CHEST_BOAT", "CHERRY_CHEST_BOAT", "DARK_OAK_CHEST_BOAT",
"JUNGLE_CHEST_BOAT", "MANGROVE_CHEST_BOAT", "OAK_CHEST_BOAT", "PALE_OAK_CHEST_BOAT",
"SPRUCE_CHEST_BOAT", "BAMBOO_CHEST_RAFT" -> {
ChestBoat boat = (ChestBoat) entity;
this.dataByte = getOrdinal(Boat.Type.values(), boat.getBoatType());
storeInventory(boat);
}
case "ARROW", "EGG", "ENDER_CRYSTAL", "ENDER_PEARL", "ENDER_SIGNAL", "EXPERIENCE_ORB", "FALLING_BLOCK", "FIREBALL", case "ARROW", "EGG", "ENDER_CRYSTAL", "ENDER_PEARL", "ENDER_SIGNAL", "EXPERIENCE_ORB", "FALLING_BLOCK", "FIREBALL",
"FIREWORK", "FISHING_HOOK", "LEASH_HITCH", "LIGHTNING", "MINECART", "MINECART_COMMAND", "MINECART_MOB_SPAWNER", "FIREWORK", "FISHING_HOOK", "LEASH_HITCH", "LIGHTNING", "MINECART", "MINECART_COMMAND", "MINECART_MOB_SPAWNER",
"MINECART_TNT", "PLAYER", "PRIMED_TNT", "SLIME", "SMALL_FIREBALL", "SNOWBALL", "MINECART_FURNACE", "SPLASH_POTION", "MINECART_TNT", "PLAYER", "PRIMED_TNT", "SLIME", "SMALL_FIREBALL", "SNOWBALL", "MINECART_FURNACE", "SPLASH_POTION",
@ -117,7 +124,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
return; return;
} }
// MISC // // MISC //
case "DROPPED_ITEM" -> { case "DROPPED_ITEM", "ITEM" -> {
Item item = (Item) entity; Item item = (Item) entity;
this.stack = item.getItemStack(); this.stack = item.getItemStack();
return; return;
@ -147,14 +154,14 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
} }
// END MISC // // END MISC //
// INVENTORY HOLDER // // INVENTORY HOLDER //
case "MINECART_CHEST", "MINECART_HOPPER" -> { case "MINECART_CHEST", "CHEST_MINECART", "MINECART_HOPPER", "HOPPER_MINECART" -> {
storeInventory((InventoryHolder) entity); storeInventory((InventoryHolder) entity);
return; return;
} }
// START LIVING ENTITY // // START LIVING ENTITY //
// START AGEABLE // // START AGEABLE //
// START TAMEABLE // // START TAMEABLE //
case "HORSE", "DONKEY", "LLAMA", "MULE", "SKELETON_HORSE" -> { case "CAMEL", "HORSE", "DONKEY", "LLAMA", "TRADER_LLAMA", "MULE", "SKELETON_HORSE", "ZOMBIE_HORSE" -> {
AbstractHorse horse = (AbstractHorse) entity; AbstractHorse horse = (AbstractHorse) entity;
this.horse = new HorseStats(); this.horse = new HorseStats();
this.horse.jump = horse.getJumpStrength(); this.horse.jump = horse.getJumpStrength();
@ -172,14 +179,13 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
return; return;
} }
// END INVENTORY HOLDER // // END INVENTORY HOLDER //
case "WOLF", "OCELOT" -> { case "WOLF", "OCELOT", "CAT", "PARROT" -> {
storeTameable((Tameable) entity); storeTameable((Tameable) entity);
storeBreedable((Breedable) entity); storeBreedable((Breedable) entity);
storeLiving((LivingEntity) entity); storeLiving((LivingEntity) entity);
return; return;
} }
// END TAMEABLE // // END TAMEABLE //
//todo fix sheep
case "SHEEP" -> { case "SHEEP" -> {
Sheep sheep = (Sheep) entity; Sheep sheep = (Sheep) entity;
if (sheep.isSheared()) { if (sheep.isSheared()) {
@ -187,7 +193,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
} else { } else {
this.dataByte = (byte) 0; this.dataByte = (byte) 0;
} }
this.dataByte2 = sheep.getColor().getDyeData(); this.dataByte2 = getOrdinal(DyeColor.values(), sheep.getColor());
storeBreedable(sheep); storeBreedable(sheep);
storeLiving(sheep); storeLiving(sheep);
return; return;
@ -268,7 +274,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
} }
case "SKELETON", "WITHER_SKELETON", "GUARDIAN", "ELDER_GUARDIAN", "GHAST", "MAGMA_CUBE", "SQUID", "PIG_ZOMBIE", "HOGLIN", case "SKELETON", "WITHER_SKELETON", "GUARDIAN", "ELDER_GUARDIAN", "GHAST", "MAGMA_CUBE", "SQUID", "PIG_ZOMBIE", "HOGLIN",
"ZOMBIFIED_PIGLIN", "PIGLIN", "PIGLIN_BRUTE", "ZOMBIE", "WITHER", "WITCH", "SPIDER", "CAVE_SPIDER", "SILVERFISH", "ZOMBIFIED_PIGLIN", "PIGLIN", "PIGLIN_BRUTE", "ZOMBIE", "WITHER", "WITCH", "SPIDER", "CAVE_SPIDER", "SILVERFISH",
"GIANT", "ENDERMAN", "CREEPER", "BLAZE", "SHULKER", "SNOWMAN" -> { "GIANT", "ENDERMAN", "CREEPER", "BLAZE", "SHULKER", "SNOWMAN", "SNOW_GOLEM" -> {
storeLiving((LivingEntity) entity); storeLiving((LivingEntity) entity);
return; return;
} }
@ -450,7 +456,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
} }
Entity entity; Entity entity;
switch (this.getType().toString()) { switch (this.getType().toString()) {
case "DROPPED_ITEM" -> { case "DROPPED_ITEM", "ITEM" -> {
return world.dropItem(location, this.stack); return world.dropItem(location, this.stack);
} }
case "PLAYER", "LEASH_HITCH" -> { case "PLAYER", "LEASH_HITCH" -> {
@ -486,15 +492,25 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
entity.setGravity(false); entity.setGravity(false);
} }
switch (entity.getType().toString()) { switch (entity.getType().toString()) {
case "BOAT" -> { case "BOAT", "ACACIA_BOAT", "BIRCH_BOAT", "CHERRY_BOAT", "DARK_OAK_BOAT", "JUNGLE_BOAT", "MANGROVE_BOAT",
"OAK_BOAT", "PALE_OAK_BOAT", "SPRUCE_BOAT", "BAMBOO_RAFT" -> {
Boat boat = (Boat) entity; Boat boat = (Boat) entity;
boat.setWoodType(TreeSpecies.values()[dataByte]); boat.setBoatType(Boat.Type.values()[dataByte]);
return entity; return entity;
} }
case "SLIME" -> { case "ACACIA_CHEST_BOAT", "BIRCH_CHEST_BOAT", "CHERRY_CHEST_BOAT", "DARK_OAK_CHEST_BOAT",
"JUNGLE_CHEST_BOAT", "MANGROVE_CHEST_BOAT", "OAK_CHEST_BOAT", "PALE_OAK_CHEST_BOAT",
"SPRUCE_CHEST_BOAT", "BAMBOO_CHEST_RAFT" -> {
ChestBoat boat = (ChestBoat) entity;
boat.setBoatType(Boat.Type.values()[dataByte]);
restoreInventory(boat);
return entity;
}
// SLIME is not even stored
/* case "SLIME" -> {
((Slime) entity).setSize(this.dataByte); ((Slime) entity).setSize(this.dataByte);
return entity; return entity;
} } */
case "ARROW", "EGG", "ENDER_CRYSTAL", "ENDER_PEARL", "ENDER_SIGNAL", "DROPPED_ITEM", "EXPERIENCE_ORB", "FALLING_BLOCK", case "ARROW", "EGG", "ENDER_CRYSTAL", "ENDER_PEARL", "ENDER_SIGNAL", "DROPPED_ITEM", "EXPERIENCE_ORB", "FALLING_BLOCK",
"FIREBALL", "FIREWORK", "FISHING_HOOK", "LEASH_HITCH", "LIGHTNING", "MINECART", "MINECART_COMMAND", "FIREBALL", "FIREWORK", "FISHING_HOOK", "LEASH_HITCH", "LIGHTNING", "MINECART", "MINECART_COMMAND",
"MINECART_MOB_SPAWNER", "MINECART_TNT", "PLAYER", "PRIMED_TNT", "SMALL_FIREBALL", "SNOWBALL", "MINECART_MOB_SPAWNER", "MINECART_TNT", "PLAYER", "PRIMED_TNT", "SMALL_FIREBALL", "SNOWBALL",
@ -518,14 +534,14 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
} }
// END MISC // // END MISC //
// INVENTORY HOLDER // // INVENTORY HOLDER //
case "MINECART_CHEST", "MINECART_HOPPER" -> { case "MINECART_CHEST", "CHEST_MINECART", "MINECART_HOPPER", "HOPPER_MINECART" -> {
restoreInventory((InventoryHolder) entity); restoreInventory((InventoryHolder) entity);
return entity; return entity;
} }
// START LIVING ENTITY // // START LIVING ENTITY //
// START AGEABLE // // START AGEABLE //
// START TAMEABLE // // START TAMEABLE //
case "HORSE", "LLAMA", "SKELETON_HORSE", "DONKEY", "MULE" -> { case "CAMEL", "HORSE", "DONKEY", "LLAMA", "TRADER_LLAMA", "MULE", "SKELETON_HORSE", "ZOMBIE_HORSE" -> {
AbstractHorse horse = (AbstractHorse) entity; AbstractHorse horse = (AbstractHorse) entity;
horse.setJumpStrength(this.horse.jump); horse.setJumpStrength(this.horse.jump);
if (horse instanceof ChestedHorse) { if (horse instanceof ChestedHorse) {
@ -542,7 +558,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
return entity; return entity;
} }
// END INVENTORY HOLDER // // END INVENTORY HOLDER //
case "WOLF", "OCELOT" -> { case "WOLF", "OCELOT", "CAT", "PARROT" -> {
restoreTameable((Tameable) entity); restoreTameable((Tameable) entity);
restoreBreedable((Breedable) entity); restoreBreedable((Breedable) entity);
restoreLiving((LivingEntity) entity); restoreLiving((LivingEntity) entity);
@ -555,7 +571,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
sheep.setSheared(true); sheep.setSheared(true);
} }
if (this.dataByte2 != 0) { if (this.dataByte2 != 0) {
sheep.setColor(DyeColor.getByDyeData(this.dataByte2)); sheep.setColor(DyeColor.values()[this.dataByte2]);
} }
restoreBreedable(sheep); restoreBreedable(sheep);
restoreLiving(sheep); restoreLiving(sheep);

View File

@ -42,6 +42,7 @@ import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.PlotFlagUtil; import com.plotsquared.core.util.PlotFlagUtil;
import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.util.Enums;
import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockType;
import io.papermc.lib.PaperLib; import io.papermc.lib.PaperLib;
import org.bukkit.Material; import org.bukkit.Material;
@ -57,6 +58,7 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile; import org.bukkit.entity.Projectile;
import org.bukkit.entity.TNTPrimed; import org.bukkit.entity.TNTPrimed;
import org.bukkit.entity.Vehicle; import org.bukkit.entity.Vehicle;
import org.bukkit.entity.minecart.ExplosiveMinecart;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -78,10 +80,17 @@ import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Objects;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class EntityEventListener implements Listener { public class EntityEventListener implements Listener {
private static final Particle EXPLOSION_HUGE = Objects.requireNonNull(Enums.findByValue(
Particle.class,
"EXPLOSION_EMITTER",
"EXPLOSION_HUGE"
));
private final BukkitPlatform platform; private final BukkitPlatform platform;
private final PlotAreaManager plotAreaManager; private final PlotAreaManager plotAreaManager;
private final EventDispatcher eventDispatcher; private final EventDispatcher eventDispatcher;
@ -314,7 +323,7 @@ public class EntityEventListener implements Listener {
if (this.lastRadius != 0) { if (this.lastRadius != 0) {
List<Entity> nearby = event.getEntity().getNearbyEntities(this.lastRadius, this.lastRadius, this.lastRadius); List<Entity> nearby = event.getEntity().getNearbyEntities(this.lastRadius, this.lastRadius, this.lastRadius);
for (Entity near : nearby) { for (Entity near : nearby) {
if (near instanceof TNTPrimed || near.getType().equals(EntityType.MINECART_TNT)) { if (near instanceof TNTPrimed || near instanceof ExplosiveMinecart) {
if (!near.hasMetadata("plot")) { if (!near.hasMetadata("plot")) {
near.setMetadata("plot", new FixedMetadataValue((Plugin) PlotSquared.platform(), plot)); near.setMetadata("plot", new FixedMetadataValue((Plugin) PlotSquared.platform(), plot));
} }
@ -338,7 +347,7 @@ public class EntityEventListener implements Listener {
event.setCancelled(true); event.setCancelled(true);
//Spawn Explosion Particles when enabled in settings //Spawn Explosion Particles when enabled in settings
if (Settings.General.ALWAYS_SHOW_EXPLOSIONS) { if (Settings.General.ALWAYS_SHOW_EXPLOSIONS) {
event.getLocation().getWorld().spawnParticle(Particle.EXPLOSION_HUGE, event.getLocation(), 0); event.getLocation().getWorld().spawnParticle(EXPLOSION_HUGE, event.getLocation(), 0);
} }
} }

View File

@ -31,8 +31,10 @@ import org.bukkit.Chunk;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.ArmorStand; import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.EnderCrystal;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Item;
import org.bukkit.entity.Vehicle; import org.bukkit.entity.Vehicle;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -132,7 +134,7 @@ public class EntitySpawnListener implements Listener {
Plot plot = location.getOwnedPlotAbs(); Plot plot = location.getOwnedPlotAbs();
EntityType type = entity.getType(); EntityType type = entity.getType();
if (plot == null) { if (plot == null) {
if (type == EntityType.DROPPED_ITEM) { if (entity instanceof Item) {
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) { if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
event.setCancelled(true); event.setCancelled(true);
} }
@ -154,7 +156,7 @@ public class EntitySpawnListener implements Listener {
if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) { if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
event.setCancelled(true); event.setCancelled(true);
} }
if (type == EntityType.ENDER_CRYSTAL || type == EntityType.ARMOR_STAND) { if (entity instanceof EnderCrystal || type == EntityType.ARMOR_STAND) {
if (BukkitEntityUtil.checkEntity(entity, plot)) { if (BukkitEntityUtil.checkEntity(entity, plot)) {
event.setCancelled(true); event.setCancelled(true);
} }

View File

@ -52,6 +52,7 @@ import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.tag.Tag; import net.kyori.adventure.text.minimessage.tag.Tag;
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver; import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.NamespacedKey;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.TileState; import org.bukkit.block.TileState;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -80,6 +81,9 @@ import java.util.regex.Pattern;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class PaperListener implements Listener { public class PaperListener implements Listener {
private static final NamespacedKey ITEM = NamespacedKey.minecraft("item");
private static final NamespacedKey FISHING_BOBBER = NamespacedKey.minecraft("fishing_bobber");
private final PlotAreaManager plotAreaManager; private final PlotAreaManager plotAreaManager;
private Chunk lastChunk; private Chunk lastChunk;
@ -228,7 +232,7 @@ public class PaperListener implements Listener {
if (plot == null) { if (plot == null) {
EntityType type = event.getType(); EntityType type = event.getType();
// PreCreatureSpawnEvent **should** not be called for DROPPED_ITEM, just for the sake of consistency // PreCreatureSpawnEvent **should** not be called for DROPPED_ITEM, just for the sake of consistency
if (type == EntityType.DROPPED_ITEM) { if (type.getKey().equals(ITEM)) {
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) { if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
event.setCancelled(true); event.setCancelled(true);
} }
@ -354,7 +358,7 @@ public class PaperListener implements Listener {
event.setCancelled(true); event.setCancelled(true);
} }
} else if (!plot.isAdded(pp.getUUID())) { } else if (!plot.isAdded(pp.getUUID())) {
if (entity.getType().equals(EntityType.FISHING_HOOK)) { if (entity.getType().getKey().equals(FISHING_BOBBER)) {
if (plot.getFlag(FishingFlag.class)) { if (plot.getFlag(FishingFlag.class)) {
return; return;
} }

View File

@ -376,7 +376,7 @@ public class PlayerEventListener implements Listener {
@EventHandler @EventHandler
public void onVehicleEntityCollision(VehicleEntityCollisionEvent e) { public void onVehicleEntityCollision(VehicleEntityCollisionEvent e) {
if (e.getVehicle().getType() == EntityType.BOAT) { if (e.getVehicle() instanceof Boat) {
Location location = BukkitUtil.adapt(e.getEntity().getLocation()); Location location = BukkitUtil.adapt(e.getEntity().getLocation());
if (location.isPlotArea()) { if (location.isPlotArea()) {
if (e.getEntity() instanceof Player) { if (e.getEntity() instanceof Player) {

View File

@ -35,7 +35,7 @@ import com.plotsquared.core.util.PlotFlagUtil;
import net.kyori.adventure.text.minimessage.tag.Tag; import net.kyori.adventure.text.minimessage.tag.Tag;
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver; import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.FishHook;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile; import org.bukkit.entity.Projectile;
@ -134,7 +134,7 @@ public class ProjectileEventListener implements Listener {
event.setCancelled(true); event.setCancelled(true);
} }
} else if (!plot.isAdded(pp.getUUID())) { } else if (!plot.isAdded(pp.getUUID())) {
if (entity.getType().equals(EntityType.FISHING_HOOK)) { if (entity instanceof FishHook) {
if (plot.getFlag(FishingFlag.class)) { if (plot.getFlag(FishingFlag.class)) {
return; return;
} }
@ -194,7 +194,7 @@ public class ProjectileEventListener implements Listener {
return; return;
} }
if (plot.isAdded(pp.getUUID()) || pp.hasPermission(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER) || plot.getFlag( 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 instanceof FishHook && plot.getFlag(
FishingFlag.class))) { FishingFlag.class))) {
return; return;
} }

View File

@ -49,6 +49,7 @@ import org.bukkit.entity.Arrow;
import org.bukkit.entity.Creature; import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Firework;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile; import org.bukkit.entity.Projectile;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
@ -341,8 +342,7 @@ public class BukkitEntityUtil {
} }
//disable the firework damage. too much of a headache to support at the moment. //disable the firework damage. too much of a headache to support at the moment.
if (vplot != null) { if (vplot != null) {
if (EntityDamageEvent.DamageCause.ENTITY_EXPLOSION == cause if (EntityDamageEvent.DamageCause.ENTITY_EXPLOSION == cause && damager instanceof Firework) {
&& damager.getType() == EntityType.FIREWORK) {
return false; return false;
} }
} }

View File

@ -230,7 +230,7 @@ tasks.getByName<Jar>("jar") {
enabled = false enabled = false
} }
val supportedVersions = listOf("1.18.2", "1.19.4", "1.20.6", "1.21.1", "1.21.3") val supportedVersions = listOf("1.19.4", "1.20.6", "1.21.1", "1.21.3", "1.21.4")
tasks { tasks {
register("cacheLatestFaweArtifact") { register("cacheLatestFaweArtifact") {
val lastSuccessfulBuildUrl = uri("https://ci.athion.net/job/FastAsyncWorldEdit/lastSuccessfulBuild/api/json").toURL() val lastSuccessfulBuildUrl = uri("https://ci.athion.net/job/FastAsyncWorldEdit/lastSuccessfulBuild/api/json").toURL()