mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-04 03:03:43 +01:00 
			
		
		
		
	Compare commits
	
		
			3 Commits
		
	
	
		
			7.3.3
			...
			fix/avoid-
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					e33f534c33 | ||
| 
						 | 
					7f1f1e025e | ||
| 
						 | 
					59787fe7f3 | 
@@ -56,6 +56,7 @@ import org.bukkit.entity.Player;
 | 
			
		||||
import org.bukkit.entity.Projectile;
 | 
			
		||||
import org.bukkit.entity.TNTPrimed;
 | 
			
		||||
import org.bukkit.entity.Vehicle;
 | 
			
		||||
import org.bukkit.event.Cancellable;
 | 
			
		||||
import org.bukkit.event.EventHandler;
 | 
			
		||||
import org.bukkit.event.EventPriority;
 | 
			
		||||
import org.bukkit.event.Listener;
 | 
			
		||||
@@ -98,37 +99,25 @@ public class EntityEventListener implements Listener {
 | 
			
		||||
 | 
			
		||||
    @EventHandler(priority = EventPriority.HIGHEST)
 | 
			
		||||
    public void onEntityCombustByEntity(EntityCombustByEntityEvent event) {
 | 
			
		||||
        EntityDamageByEntityEvent eventChange =
 | 
			
		||||
                new EntityDamageByEntityEvent(
 | 
			
		||||
                        event.getCombuster(),
 | 
			
		||||
                        event.getEntity(),
 | 
			
		||||
                        EntityDamageEvent.DamageCause.FIRE_TICK,
 | 
			
		||||
                        event.getDuration()
 | 
			
		||||
                );
 | 
			
		||||
        onEntityDamageByEntityEvent(eventChange);
 | 
			
		||||
        if (eventChange.isCancelled()) {
 | 
			
		||||
            event.setCancelled(true);
 | 
			
		||||
        }
 | 
			
		||||
        onEntityDamageByEntityCommon(event.getCombuster(), event.getEntity(), EntityDamageEvent.DamageCause.FIRE_TICK, event);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @EventHandler(priority = EventPriority.HIGHEST)
 | 
			
		||||
    public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) {
 | 
			
		||||
        Entity damager = event.getDamager();
 | 
			
		||||
        onEntityDamageByEntityCommon(event.getDamager(), event.getEntity(), event.getCause(), event);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void onEntityDamageByEntityCommon(
 | 
			
		||||
            final Entity damager,
 | 
			
		||||
            final Entity victim,
 | 
			
		||||
            final EntityDamageEvent.DamageCause cause,
 | 
			
		||||
            final Cancellable event
 | 
			
		||||
    ) {
 | 
			
		||||
        Location location = BukkitUtil.adapt(damager.getLocation());
 | 
			
		||||
        if (!this.plotAreaManager.hasPlotArea(location.getWorldName())) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        Entity victim = event.getEntity();
 | 
			
		||||
/*
 | 
			
		||||
        if (victim.getType().equals(EntityType.ITEM_FRAME)) {
 | 
			
		||||
            Plot plot = BukkitUtil.getLocation(victim).getPlot();
 | 
			
		||||
            if (plot != null && !plot.isAdded(damager.getUniqueId())) {
 | 
			
		||||
                event.setCancelled(true);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
*/
 | 
			
		||||
        if (!BukkitEntityUtil.entityDamage(damager, victim, event.getCause())) {
 | 
			
		||||
        if (!BukkitEntityUtil.entityDamage(damager, victim, cause)) {
 | 
			
		||||
            if (event.isCancelled()) {
 | 
			
		||||
                if (victim instanceof Ageable ageable) {
 | 
			
		||||
                    if (ageable.getAge() == -24000) {
 | 
			
		||||
 
 | 
			
		||||
@@ -143,7 +143,7 @@ public class ClassicPlotManager extends SquarePlotManager {
 | 
			
		||||
                    classicPlotWorld,
 | 
			
		||||
                    plot.getRegions(),
 | 
			
		||||
                    blocks,
 | 
			
		||||
                    classicPlotWorld.getMinBuildHeight(),
 | 
			
		||||
                    classicPlotWorld.getMinComponentHeight(),
 | 
			
		||||
                    classicPlotWorld.getMaxBuildHeight() - 1,
 | 
			
		||||
                    actor,
 | 
			
		||||
                    queue
 | 
			
		||||
@@ -204,7 +204,7 @@ public class ClassicPlotManager extends SquarePlotManager {
 | 
			
		||||
                    classicPlotWorld,
 | 
			
		||||
                    plot.getRegions(),
 | 
			
		||||
                    blocks,
 | 
			
		||||
                    classicPlotWorld.getMinBuildHeight(),
 | 
			
		||||
                    classicPlotWorld.getMinComponentHeight(),
 | 
			
		||||
                    classicPlotWorld.PLOT_HEIGHT - 1,
 | 
			
		||||
                    actor,
 | 
			
		||||
                    queue
 | 
			
		||||
@@ -379,7 +379,7 @@ public class ClassicPlotManager extends SquarePlotManager {
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        int yStart = classicPlotWorld.getMinBuildHeight() + (classicPlotWorld.PLOT_BEDROCK ? 1 : 0);
 | 
			
		||||
        int yStart = classicPlotWorld.getMinComponentHeight();
 | 
			
		||||
        if (!plot.isMerged(Direction.NORTH)) {
 | 
			
		||||
            int z = bot.getZ();
 | 
			
		||||
            for (int x = bot.getX(); x < top.getX(); x++) {
 | 
			
		||||
 
 | 
			
		||||
@@ -52,6 +52,7 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld {
 | 
			
		||||
    public BlockBucket ROAD_BLOCK = new BlockBucket(BlockTypes.QUARTZ_BLOCK);
 | 
			
		||||
    public boolean PLOT_BEDROCK = true;
 | 
			
		||||
    public boolean PLACE_TOP_BLOCK = true;
 | 
			
		||||
    public boolean COMPONENT_BELOW_BEDROCK = false;
 | 
			
		||||
 | 
			
		||||
    public ClassicPlotWorld(
 | 
			
		||||
            final @NonNull String worldName,
 | 
			
		||||
@@ -129,6 +130,9 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld {
 | 
			
		||||
                ),
 | 
			
		||||
                new ConfigurationNode("plot.bedrock", this.PLOT_BEDROCK, TranslatableCaption.of("setup.bedrock_boolean"),
 | 
			
		||||
                        ConfigurationUtil.BOOLEAN
 | 
			
		||||
                ),
 | 
			
		||||
                new ConfigurationNode("world.component_below_bedrock", this.COMPONENT_BELOW_BEDROCK, TranslatableCaption.of(
 | 
			
		||||
                        "setup.component_below_bedrock_boolean"), ConfigurationUtil.BOOLEAN
 | 
			
		||||
                )};
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -150,6 +154,14 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld {
 | 
			
		||||
        this.PLACE_TOP_BLOCK = config.getBoolean("wall.place_top_block");
 | 
			
		||||
        this.WALL_HEIGHT = Math.min(getMaxGenHeight() - (PLACE_TOP_BLOCK ? 1 : 0), config.getInt("wall.height"));
 | 
			
		||||
        this.CLAIMED_WALL_BLOCK = createCheckedBlockBucket(config.getString("wall.block_claimed"), CLAIMED_WALL_BLOCK);
 | 
			
		||||
        this.COMPONENT_BELOW_BEDROCK = config.getBoolean("world.component_below_bedrock");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public int getMinComponentHeight() {
 | 
			
		||||
        return COMPONENT_BELOW_BEDROCK && getMinGenHeight() >= getMinBuildHeight()
 | 
			
		||||
                ? getMinGenHeight() + (PLOT_BEDROCK ? 1 : 0)
 | 
			
		||||
                : getMinBuildHeight();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    int schematicStartHeight() {
 | 
			
		||||
 
 | 
			
		||||
@@ -1452,6 +1452,24 @@ public abstract class PlotArea implements ComponentLike {
 | 
			
		||||
        this.defaultHome = defaultHome;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the maximum height that changes to plot components (wall filling, air, all etc.) may operate to
 | 
			
		||||
     *
 | 
			
		||||
     * @since TODO
 | 
			
		||||
     */
 | 
			
		||||
    public int getMaxComponentHeight() {
 | 
			
		||||
        return this.maxBuildHeight;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the minimum height that changes to plot components (wall filling, air, all etc.) may operate to
 | 
			
		||||
     *
 | 
			
		||||
     * @since TODO
 | 
			
		||||
     */
 | 
			
		||||
    public int getMinComponentHeight() {
 | 
			
		||||
        return this.minBuildHeight;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the maximum height players may build in. Exclusive.
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
@@ -166,6 +166,7 @@
 | 
			
		||||
  "setup.wall_height": "<gold>Wall height</gold>",
 | 
			
		||||
  "setup.min_gen_height": "<gold>Minimum height from which to generate (for 1.18+ can be negative).</gold>",
 | 
			
		||||
  "setup.bedrock_boolean": "<gold>Whether a bedrock layer under the plot should be generated or not</gold>",
 | 
			
		||||
  "setup.component_below_bedrock_boolean": "<gold>Whether a component change e.g. /plot set walls should edit the bedrock layer or below</gold>",
 | 
			
		||||
  "setup.singleplotarea_void_world": "<gold>Void world</gold>",
 | 
			
		||||
  "plotareatype.plot_area_type_normal": "<gray>Standard plot generation</gray>",
 | 
			
		||||
  "plotareatype.plot_area_type_augmented": "<gray>Plot generation with vanilla terrain</gray>",
 | 
			
		||||
 
 | 
			
		||||
@@ -22,7 +22,7 @@ plugins {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
group = "com.intellectualsites.plotsquared"
 | 
			
		||||
version = "7.3.3"
 | 
			
		||||
version = "7.3.4-SNAPSHOT"
 | 
			
		||||
 | 
			
		||||
if (!File("$rootDir/.git").exists()) {
 | 
			
		||||
    logger.lifecycle("""
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user