Compare commits

..

1 Commits

Author SHA1 Message Date
e33f534c33 Avoid creating EntityDamageByEntityEvent 2024-02-12 15:32:09 +01:00
7 changed files with 7 additions and 33 deletions

View File

@ -779,8 +779,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
Iterator<Entity> iterator = entities.iterator(); Iterator<Entity> iterator = entities.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
Entity entity = iterator.next(); Entity entity = iterator.next();
//noinspection ConstantValue - getEntitySpawnReason annotated as NotNull, but is not NotNull. lol. if (PaperLib.isPaper() && "CUSTOM".equals(entity.getEntitySpawnReason().name())) {
if (PaperLib.isPaper() && entity.getEntitySpawnReason() != null && "CUSTOM".equals(entity.getEntitySpawnReason().name())) {
continue; continue;
} }
// Fallback for Spigot not having Entity#getEntitySpawnReason // Fallback for Spigot not having Entity#getEntitySpawnReason

View File

@ -152,13 +152,13 @@ public class EntityEventListener implements Listener {
} }
case "REINFORCEMENTS", "NATURAL", "MOUNT", "PATROL", "RAID", "SHEARED", "SILVERFISH_BLOCK", "ENDER_PEARL", case "REINFORCEMENTS", "NATURAL", "MOUNT", "PATROL", "RAID", "SHEARED", "SILVERFISH_BLOCK", "ENDER_PEARL",
"TRAP", "VILLAGE_DEFENSE", "VILLAGE_INVASION", "BEEHIVE", "CHUNK_GEN", "NETHER_PORTAL", "TRAP", "VILLAGE_DEFENSE", "VILLAGE_INVASION", "BEEHIVE", "CHUNK_GEN", "NETHER_PORTAL",
"FROZEN", "SPELL", "DEFAULT" -> { "DUPLICATION", "FROZEN", "SPELL", "DEFAULT" -> {
if (!area.isMobSpawning()) { if (!area.isMobSpawning()) {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
} }
case "BREEDING", "DUPLICATION" -> { case "BREEDING" -> {
if (!area.isSpawnBreeding()) { if (!area.isSpawnBreeding()) {
event.setCancelled(true); event.setCancelled(true);
return; return;

View File

@ -124,8 +124,7 @@ public class EntitySpawnListener implements Listener {
return; return;
} }
if (PaperLib.isPaper()) { if (PaperLib.isPaper()) {
//noinspection ConstantValue - getEntitySpawnReason annotated as NotNull, but is not NotNull. lol. if (area.isSpawnCustom() && "CUSTOM".equals(entity.getEntitySpawnReason().name())) {
if (area.isSpawnCustom() && entity.getEntitySpawnReason() != null && "CUSTOM".equals(entity.getEntitySpawnReason().name())) {
return; return;
} }
} }

View File

@ -20,8 +20,6 @@ package com.plotsquared.bukkit.placeholder;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
import com.plotsquared.core.util.query.PlotQuery;
import me.clip.placeholderapi.PlaceholderAPIPlugin; import me.clip.placeholderapi.PlaceholderAPIPlugin;
import me.clip.placeholderapi.expansion.PlaceholderExpansion; import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -85,20 +83,6 @@ public class PAPIPlaceholders extends PlaceholderExpansion {
return String.valueOf(pl.getPlotCount(identifier)); return String.valueOf(pl.getPlotCount(identifier));
} }
if (identifier.startsWith("base_plot_count_")) {
identifier = identifier.substring("base_plot_count_".length());
if (identifier.isEmpty()) {
return "";
}
return String.valueOf(PlotQuery.newQuery()
.ownedBy(pl)
.inWorld(identifier)
.whereBasePlot()
.thatPasses(plot -> !DoneFlag.isDone(plot))
.count());
}
// PlotSquared placeholders // PlotSquared placeholders
return PlotSquared.platform().placeholderRegistry().getPlaceholderValue(identifier, pl); return PlotSquared.platform().placeholderRegistry().getPlaceholderValue(identifier, pl);
} }

View File

@ -1455,7 +1455,7 @@ public abstract class PlotArea implements ComponentLike {
/** /**
* Get the maximum height that changes to plot components (wall filling, air, all etc.) may operate to * Get the maximum height that changes to plot components (wall filling, air, all etc.) may operate to
* *
* @since 7.3.4 * @since TODO
*/ */
public int getMaxComponentHeight() { public int getMaxComponentHeight() {
return this.maxBuildHeight; return this.maxBuildHeight;
@ -1464,7 +1464,7 @@ public abstract class PlotArea implements ComponentLike {
/** /**
* Get the minimum height that changes to plot components (wall filling, air, all etc.) may operate to * Get the minimum height that changes to plot components (wall filling, air, all etc.) may operate to
* *
* @since 7.3.4 * @since TODO
*/ */
public int getMinComponentHeight() { public int getMinComponentHeight() {
return this.minBuildHeight; return this.minBuildHeight;

View File

@ -31,11 +31,9 @@ import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.flag.GlobalFlagContainer; import com.plotsquared.core.plot.flag.GlobalFlagContainer;
import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.flag.PlotFlag;
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
import com.plotsquared.core.plot.flag.implementations.ServerPlotFlag; import com.plotsquared.core.plot.flag.implementations.ServerPlotFlag;
import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.PlayerManager; import com.plotsquared.core.util.PlayerManager;
import com.plotsquared.core.util.query.PlotQuery;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
@ -97,12 +95,6 @@ public final class PlaceholderRegistry {
} }
return Integer.toString(player.getAllowedPlots()); return Integer.toString(player.getAllowedPlots());
}); });
this.createPlaceholder("base_plot_count", player -> Integer.toString(PlotQuery.newQuery()
.ownedBy(player)
.whereBasePlot()
.thatPasses(plot -> !DoneFlag.isDone(plot))
.count())
);
this.createPlaceholder("plot_count", player -> Integer.toString(player.getPlotCount())); this.createPlaceholder("plot_count", player -> Integer.toString(player.getPlotCount()));
this.createPlaceholder("currentplot_alias", (player, plot) -> { this.createPlaceholder("currentplot_alias", (player, plot) -> {
if (plot.getAlias().isEmpty()) { if (plot.getAlias().isEmpty()) {

View File

@ -22,7 +22,7 @@ plugins {
} }
group = "com.intellectualsites.plotsquared" group = "com.intellectualsites.plotsquared"
version = "7.3.4" version = "7.3.4-SNAPSHOT"
if (!File("$rootDir/.git").exists()) { if (!File("$rootDir/.git").exists()) {
logger.lifecycle(""" logger.lifecycle("""