mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-04 11:13:45 +01:00 
			
		
		
		
	1.21.4 (#4582)
* 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:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							4e2ea67992
						
					
				
				
					commit
					d4f10422e3
				
			@@ -789,22 +789,23 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
 | 
			
		||||
                    if (entity.getMetadata("ps_custom_spawned").stream().anyMatch(MetadataValue::asBoolean)) {
 | 
			
		||||
                        continue;
 | 
			
		||||
                    }
 | 
			
		||||
                    // TODO: use (type) pattern matching when targeting java 21
 | 
			
		||||
                    switch (entity.getType().toString()) {
 | 
			
		||||
                        case "EGG":
 | 
			
		||||
                        case "FISHING_HOOK":
 | 
			
		||||
                        case "ENDER_SIGNAL":
 | 
			
		||||
                        case "FISHING_HOOK", "FISHING_BOBBER":
 | 
			
		||||
                        case "ENDER_SIGNAL", "EYE_OF_ENDER":
 | 
			
		||||
                        case "AREA_EFFECT_CLOUD":
 | 
			
		||||
                        case "EXPERIENCE_ORB":
 | 
			
		||||
                        case "LEASH_HITCH":
 | 
			
		||||
                        case "FIREWORK":
 | 
			
		||||
                        case "LIGHTNING":
 | 
			
		||||
                        case "LEASH_HITCH", "LEASH_KNOT":
 | 
			
		||||
                        case "FIREWORK", "FIREWORK_ROCKET":
 | 
			
		||||
                        case "LIGHTNING", "LIGHTNING_BOLT":
 | 
			
		||||
                        case "WITHER_SKULL":
 | 
			
		||||
                        case "UNKNOWN":
 | 
			
		||||
                        case "PLAYER":
 | 
			
		||||
                            // non moving / unmovable
 | 
			
		||||
                            continue;
 | 
			
		||||
                        case "THROWN_EXP_BOTTLE":
 | 
			
		||||
                        case "SPLASH_POTION":
 | 
			
		||||
                        case "THROWN_EXP_BOTTLE", "EXPERIENCE_BOTTLE":
 | 
			
		||||
                        case "SPLASH_POTION", "POTION":
 | 
			
		||||
                        case "SNOWBALL":
 | 
			
		||||
                        case "SHULKER_BULLET":
 | 
			
		||||
                        case "SPECTRAL_ARROW":
 | 
			
		||||
@@ -836,6 +837,11 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
 | 
			
		||||
                        case "TNT_MINECART":
 | 
			
		||||
                        case "CHEST_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) {
 | 
			
		||||
                                com.plotsquared.core.location.Location location = BukkitUtil.adapt(entity.getLocation());
 | 
			
		||||
                                Plot plot = location.getPlot();
 | 
			
		||||
@@ -864,14 +870,14 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
 | 
			
		||||
                        case "SMALL_FIREBALL":
 | 
			
		||||
                        case "FIREBALL":
 | 
			
		||||
                        case "DRAGON_FIREBALL":
 | 
			
		||||
                        case "DROPPED_ITEM":
 | 
			
		||||
                        case "DROPPED_ITEM", "ITEM":
 | 
			
		||||
                            if (Settings.Enabled_Components.KILL_ROAD_ITEMS
 | 
			
		||||
                                    && plotArea.getOwnedPlotAbs(BukkitUtil.adapt(entity.getLocation())) == null) {
 | 
			
		||||
                                this.removeRoadEntity(entity, iterator);
 | 
			
		||||
                            }
 | 
			
		||||
                            // dropped item
 | 
			
		||||
                            continue;
 | 
			
		||||
                        case "PRIMED_TNT":
 | 
			
		||||
                        case "PRIMED_TNT", "TNT":
 | 
			
		||||
                        case "FALLING_BLOCK":
 | 
			
		||||
                            // managed elsewhere
 | 
			
		||||
                            continue;
 | 
			
		||||
@@ -949,7 +955,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
 | 
			
		||||
                        case "HORSE":
 | 
			
		||||
                        case "IRON_GOLEM":
 | 
			
		||||
                        case "MAGMA_CUBE":
 | 
			
		||||
                        case "MUSHROOM_COW":
 | 
			
		||||
                        case "MUSHROOM_COW", "MOOSHROOM":
 | 
			
		||||
                        case "OCELOT":
 | 
			
		||||
                        case "PIG":
 | 
			
		||||
                        case "PIG_ZOMBIE":
 | 
			
		||||
@@ -958,7 +964,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
 | 
			
		||||
                        case "SILVERFISH":
 | 
			
		||||
                        case "SKELETON":
 | 
			
		||||
                        case "SLIME":
 | 
			
		||||
                        case "SNOWMAN":
 | 
			
		||||
                        case "SNOWMAN", "SNOW_GOLEM":
 | 
			
		||||
                        case "SPIDER":
 | 
			
		||||
                        case "SQUID":
 | 
			
		||||
                        case "VILLAGER":
 | 
			
		||||
 
 | 
			
		||||
@@ -25,7 +25,6 @@ import org.bukkit.Art;
 | 
			
		||||
import org.bukkit.DyeColor;
 | 
			
		||||
import org.bukkit.Location;
 | 
			
		||||
import org.bukkit.Rotation;
 | 
			
		||||
import org.bukkit.TreeSpecies;
 | 
			
		||||
import org.bukkit.World;
 | 
			
		||||
import org.bukkit.block.BlockFace;
 | 
			
		||||
import org.bukkit.entity.AbstractHorse;
 | 
			
		||||
@@ -34,6 +33,7 @@ import org.bukkit.entity.ArmorStand;
 | 
			
		||||
import org.bukkit.entity.Bat;
 | 
			
		||||
import org.bukkit.entity.Boat;
 | 
			
		||||
import org.bukkit.entity.Breedable;
 | 
			
		||||
import org.bukkit.entity.ChestBoat;
 | 
			
		||||
import org.bukkit.entity.ChestedHorse;
 | 
			
		||||
import org.bukkit.entity.EnderDragon;
 | 
			
		||||
import org.bukkit.entity.Entity;
 | 
			
		||||
@@ -44,7 +44,6 @@ import org.bukkit.entity.LivingEntity;
 | 
			
		||||
import org.bukkit.entity.Painting;
 | 
			
		||||
import org.bukkit.entity.Rabbit;
 | 
			
		||||
import org.bukkit.entity.Sheep;
 | 
			
		||||
import org.bukkit.entity.Slime;
 | 
			
		||||
import org.bukkit.entity.Tameable;
 | 
			
		||||
import org.bukkit.inventory.EntityEquipment;
 | 
			
		||||
import org.bukkit.inventory.InventoryHolder;
 | 
			
		||||
@@ -103,11 +102,19 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
 | 
			
		||||
            this.noGravity = true;
 | 
			
		||||
        }
 | 
			
		||||
        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;
 | 
			
		||||
                this.dataByte = getOrdinal(TreeSpecies.values(), boat.getWoodType());
 | 
			
		||||
                this.dataByte = getOrdinal(Boat.Type.values(), boat.getBoatType());
 | 
			
		||||
                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",
 | 
			
		||||
                    "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",
 | 
			
		||||
@@ -117,7 +124,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            // MISC //
 | 
			
		||||
            case "DROPPED_ITEM" -> {
 | 
			
		||||
            case "DROPPED_ITEM", "ITEM" -> {
 | 
			
		||||
                Item item = (Item) entity;
 | 
			
		||||
                this.stack = item.getItemStack();
 | 
			
		||||
                return;
 | 
			
		||||
@@ -147,14 +154,14 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
 | 
			
		||||
            }
 | 
			
		||||
            // END MISC //
 | 
			
		||||
            // INVENTORY HOLDER //
 | 
			
		||||
            case "MINECART_CHEST", "MINECART_HOPPER" -> {
 | 
			
		||||
            case "MINECART_CHEST", "CHEST_MINECART", "MINECART_HOPPER", "HOPPER_MINECART" -> {
 | 
			
		||||
                storeInventory((InventoryHolder) entity);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            // START LIVING ENTITY //
 | 
			
		||||
            // START AGEABLE //
 | 
			
		||||
            // 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;
 | 
			
		||||
                this.horse = new HorseStats();
 | 
			
		||||
                this.horse.jump = horse.getJumpStrength();
 | 
			
		||||
@@ -172,14 +179,13 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            // END INVENTORY HOLDER //
 | 
			
		||||
            case "WOLF", "OCELOT" -> {
 | 
			
		||||
            case "WOLF", "OCELOT", "CAT", "PARROT" -> {
 | 
			
		||||
                storeTameable((Tameable) entity);
 | 
			
		||||
                storeBreedable((Breedable) entity);
 | 
			
		||||
                storeLiving((LivingEntity) entity);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            // END TAMEABLE //
 | 
			
		||||
            //todo fix sheep
 | 
			
		||||
            case "SHEEP" -> {
 | 
			
		||||
                Sheep sheep = (Sheep) entity;
 | 
			
		||||
                if (sheep.isSheared()) {
 | 
			
		||||
@@ -187,7 +193,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
 | 
			
		||||
                } else {
 | 
			
		||||
                    this.dataByte = (byte) 0;
 | 
			
		||||
                }
 | 
			
		||||
                this.dataByte2 = sheep.getColor().getDyeData();
 | 
			
		||||
                this.dataByte2 = getOrdinal(DyeColor.values(), sheep.getColor());
 | 
			
		||||
                storeBreedable(sheep);
 | 
			
		||||
                storeLiving(sheep);
 | 
			
		||||
                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",
 | 
			
		||||
                    "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);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
@@ -450,7 +456,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
 | 
			
		||||
        }
 | 
			
		||||
        Entity entity;
 | 
			
		||||
        switch (this.getType().toString()) {
 | 
			
		||||
            case "DROPPED_ITEM" -> {
 | 
			
		||||
            case "DROPPED_ITEM", "ITEM" -> {
 | 
			
		||||
                return world.dropItem(location, this.stack);
 | 
			
		||||
            }
 | 
			
		||||
            case "PLAYER", "LEASH_HITCH" -> {
 | 
			
		||||
@@ -486,15 +492,25 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
 | 
			
		||||
            entity.setGravity(false);
 | 
			
		||||
        }
 | 
			
		||||
        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.setWoodType(TreeSpecies.values()[dataByte]);
 | 
			
		||||
                boat.setBoatType(Boat.Type.values()[dataByte]);
 | 
			
		||||
                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);
 | 
			
		||||
                return entity;
 | 
			
		||||
            }
 | 
			
		||||
            } */
 | 
			
		||||
            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",
 | 
			
		||||
                    "MINECART_MOB_SPAWNER", "MINECART_TNT", "PLAYER", "PRIMED_TNT", "SMALL_FIREBALL", "SNOWBALL",
 | 
			
		||||
@@ -518,14 +534,14 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
 | 
			
		||||
            }
 | 
			
		||||
            // END MISC //
 | 
			
		||||
            // INVENTORY HOLDER //
 | 
			
		||||
            case "MINECART_CHEST", "MINECART_HOPPER" -> {
 | 
			
		||||
            case "MINECART_CHEST", "CHEST_MINECART", "MINECART_HOPPER", "HOPPER_MINECART" -> {
 | 
			
		||||
                restoreInventory((InventoryHolder) entity);
 | 
			
		||||
                return entity;
 | 
			
		||||
            }
 | 
			
		||||
            // START LIVING ENTITY //
 | 
			
		||||
            // START AGEABLE //
 | 
			
		||||
            // 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;
 | 
			
		||||
                horse.setJumpStrength(this.horse.jump);
 | 
			
		||||
                if (horse instanceof ChestedHorse) {
 | 
			
		||||
@@ -542,7 +558,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
 | 
			
		||||
                return entity;
 | 
			
		||||
            }
 | 
			
		||||
            // END INVENTORY HOLDER //
 | 
			
		||||
            case "WOLF", "OCELOT" -> {
 | 
			
		||||
            case "WOLF", "OCELOT", "CAT", "PARROT" -> {
 | 
			
		||||
                restoreTameable((Tameable) entity);
 | 
			
		||||
                restoreBreedable((Breedable) entity);
 | 
			
		||||
                restoreLiving((LivingEntity) entity);
 | 
			
		||||
@@ -555,7 +571,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
 | 
			
		||||
                    sheep.setSheared(true);
 | 
			
		||||
                }
 | 
			
		||||
                if (this.dataByte2 != 0) {
 | 
			
		||||
                    sheep.setColor(DyeColor.getByDyeData(this.dataByte2));
 | 
			
		||||
                    sheep.setColor(DyeColor.values()[this.dataByte2]);
 | 
			
		||||
                }
 | 
			
		||||
                restoreBreedable(sheep);
 | 
			
		||||
                restoreLiving(sheep);
 | 
			
		||||
 
 | 
			
		||||
@@ -42,6 +42,7 @@ import com.plotsquared.core.plot.world.PlotAreaManager;
 | 
			
		||||
import com.plotsquared.core.util.EventDispatcher;
 | 
			
		||||
import com.plotsquared.core.util.PlotFlagUtil;
 | 
			
		||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
 | 
			
		||||
import com.sk89q.worldedit.util.Enums;
 | 
			
		||||
import com.sk89q.worldedit.world.block.BlockType;
 | 
			
		||||
import io.papermc.lib.PaperLib;
 | 
			
		||||
import org.bukkit.Material;
 | 
			
		||||
@@ -57,6 +58,7 @@ import org.bukkit.entity.Player;
 | 
			
		||||
import org.bukkit.entity.Projectile;
 | 
			
		||||
import org.bukkit.entity.TNTPrimed;
 | 
			
		||||
import org.bukkit.entity.Vehicle;
 | 
			
		||||
import org.bukkit.entity.minecart.ExplosiveMinecart;
 | 
			
		||||
import org.bukkit.event.Cancellable;
 | 
			
		||||
import org.bukkit.event.EventHandler;
 | 
			
		||||
import org.bukkit.event.EventPriority;
 | 
			
		||||
@@ -78,10 +80,17 @@ import org.checkerframework.checker.nullness.qual.NonNull;
 | 
			
		||||
 | 
			
		||||
import java.util.Iterator;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Objects;
 | 
			
		||||
 | 
			
		||||
@SuppressWarnings("unused")
 | 
			
		||||
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 PlotAreaManager plotAreaManager;
 | 
			
		||||
    private final EventDispatcher eventDispatcher;
 | 
			
		||||
@@ -152,8 +161,8 @@ public class EntityEventListener implements Listener {
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            case "REINFORCEMENTS", "NATURAL", "MOUNT", "PATROL", "RAID", "SHEARED", "SILVERFISH_BLOCK", "ENDER_PEARL",
 | 
			
		||||
                    "TRAP", "VILLAGE_DEFENSE", "VILLAGE_INVASION", "BEEHIVE", "CHUNK_GEN", "NETHER_PORTAL",
 | 
			
		||||
                    "FROZEN", "SPELL", "DEFAULT" -> {
 | 
			
		||||
                 "TRAP", "VILLAGE_DEFENSE", "VILLAGE_INVASION", "BEEHIVE", "CHUNK_GEN", "NETHER_PORTAL",
 | 
			
		||||
                 "FROZEN", "SPELL", "DEFAULT" -> {
 | 
			
		||||
                if (!area.isMobSpawning()) {
 | 
			
		||||
                    event.setCancelled(true);
 | 
			
		||||
                    return;
 | 
			
		||||
@@ -314,7 +323,7 @@ public class EntityEventListener implements Listener {
 | 
			
		||||
                if (this.lastRadius != 0) {
 | 
			
		||||
                    List<Entity> 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 instanceof ExplosiveMinecart) {
 | 
			
		||||
                            if (!near.hasMetadata("plot")) {
 | 
			
		||||
                                near.setMetadata("plot", new FixedMetadataValue((Plugin) PlotSquared.platform(), plot));
 | 
			
		||||
                            }
 | 
			
		||||
@@ -338,7 +347,7 @@ public class EntityEventListener implements Listener {
 | 
			
		||||
        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(EXPLOSION_HUGE, event.getLocation(), 0);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -31,8 +31,10 @@ import org.bukkit.Chunk;
 | 
			
		||||
import org.bukkit.World;
 | 
			
		||||
import org.bukkit.block.Block;
 | 
			
		||||
import org.bukkit.entity.ArmorStand;
 | 
			
		||||
import org.bukkit.entity.EnderCrystal;
 | 
			
		||||
import org.bukkit.entity.Entity;
 | 
			
		||||
import org.bukkit.entity.EntityType;
 | 
			
		||||
import org.bukkit.entity.Item;
 | 
			
		||||
import org.bukkit.entity.Vehicle;
 | 
			
		||||
import org.bukkit.event.EventHandler;
 | 
			
		||||
import org.bukkit.event.EventPriority;
 | 
			
		||||
@@ -132,7 +134,7 @@ public class EntitySpawnListener implements Listener {
 | 
			
		||||
        Plot plot = location.getOwnedPlotAbs();
 | 
			
		||||
        EntityType type = entity.getType();
 | 
			
		||||
        if (plot == null) {
 | 
			
		||||
            if (type == EntityType.DROPPED_ITEM) {
 | 
			
		||||
            if (entity instanceof Item) {
 | 
			
		||||
                if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
 | 
			
		||||
                    event.setCancelled(true);
 | 
			
		||||
                }
 | 
			
		||||
@@ -154,7 +156,7 @@ public class EntitySpawnListener implements Listener {
 | 
			
		||||
        if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
 | 
			
		||||
            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)) {
 | 
			
		||||
                event.setCancelled(true);
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -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.resolver.TagResolver;
 | 
			
		||||
import org.bukkit.Chunk;
 | 
			
		||||
import org.bukkit.NamespacedKey;
 | 
			
		||||
import org.bukkit.block.Block;
 | 
			
		||||
import org.bukkit.block.TileState;
 | 
			
		||||
import org.bukkit.entity.Entity;
 | 
			
		||||
@@ -80,6 +81,9 @@ import java.util.regex.Pattern;
 | 
			
		||||
@SuppressWarnings("unused")
 | 
			
		||||
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 Chunk lastChunk;
 | 
			
		||||
 | 
			
		||||
@@ -228,7 +232,7 @@ public class PaperListener implements Listener {
 | 
			
		||||
        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.getKey().equals(ITEM)) {
 | 
			
		||||
                if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
 | 
			
		||||
                    event.setCancelled(true);
 | 
			
		||||
                }
 | 
			
		||||
@@ -354,7 +358,7 @@ public class PaperListener implements Listener {
 | 
			
		||||
                event.setCancelled(true);
 | 
			
		||||
            }
 | 
			
		||||
        } 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)) {
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
 
 | 
			
		||||
@@ -376,7 +376,7 @@ public class PlayerEventListener implements Listener {
 | 
			
		||||
 | 
			
		||||
    @EventHandler
 | 
			
		||||
    public void onVehicleEntityCollision(VehicleEntityCollisionEvent e) {
 | 
			
		||||
        if (e.getVehicle().getType() == EntityType.BOAT) {
 | 
			
		||||
        if (e.getVehicle() instanceof Boat) {
 | 
			
		||||
            Location location = BukkitUtil.adapt(e.getEntity().getLocation());
 | 
			
		||||
            if (location.isPlotArea()) {
 | 
			
		||||
                if (e.getEntity() instanceof Player) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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.resolver.TagResolver;
 | 
			
		||||
import org.bukkit.entity.Entity;
 | 
			
		||||
import org.bukkit.entity.EntityType;
 | 
			
		||||
import org.bukkit.entity.FishHook;
 | 
			
		||||
import org.bukkit.entity.LivingEntity;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
import org.bukkit.entity.Projectile;
 | 
			
		||||
@@ -134,7 +134,7 @@ public class ProjectileEventListener implements Listener {
 | 
			
		||||
                event.setCancelled(true);
 | 
			
		||||
            }
 | 
			
		||||
        } else if (!plot.isAdded(pp.getUUID())) {
 | 
			
		||||
            if (entity.getType().equals(EntityType.FISHING_HOOK)) {
 | 
			
		||||
            if (entity instanceof FishHook) {
 | 
			
		||||
                if (plot.getFlag(FishingFlag.class)) {
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
@@ -194,7 +194,7 @@ public class ProjectileEventListener implements Listener {
 | 
			
		||||
                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 instanceof FishHook && plot.getFlag(
 | 
			
		||||
                    FishingFlag.class))) {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -49,6 +49,7 @@ import org.bukkit.entity.Arrow;
 | 
			
		||||
import org.bukkit.entity.Creature;
 | 
			
		||||
import org.bukkit.entity.Entity;
 | 
			
		||||
import org.bukkit.entity.EntityType;
 | 
			
		||||
import org.bukkit.entity.Firework;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
import org.bukkit.entity.Projectile;
 | 
			
		||||
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.
 | 
			
		||||
        if (vplot != null) {
 | 
			
		||||
            if (EntityDamageEvent.DamageCause.ENTITY_EXPLOSION == cause
 | 
			
		||||
                    && damager.getType() == EntityType.FIREWORK) {
 | 
			
		||||
            if (EntityDamageEvent.DamageCause.ENTITY_EXPLOSION == cause && damager instanceof Firework) {
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user