mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-04 22:54:43 +02:00
Compare commits
2 Commits
fix/out-of
...
feature/ba
Author | SHA1 | Date | |
---|---|---|---|
9de1ea8232 | |||
2f64af7ebb |
@ -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
|
||||||
|
@ -56,7 +56,6 @@ 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.event.Cancellable;
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -99,25 +98,37 @@ public class EntityEventListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onEntityCombustByEntity(EntityCombustByEntityEvent event) {
|
public void onEntityCombustByEntity(EntityCombustByEntityEvent event) {
|
||||||
onEntityDamageByEntityCommon(event.getCombuster(), event.getEntity(), EntityDamageEvent.DamageCause.FIRE_TICK, event);
|
EntityDamageByEntityEvent eventChange =
|
||||||
|
new EntityDamageByEntityEvent(
|
||||||
|
event.getCombuster(),
|
||||||
|
event.getEntity(),
|
||||||
|
EntityDamageEvent.DamageCause.FIRE_TICK,
|
||||||
|
event.getDuration()
|
||||||
|
);
|
||||||
|
onEntityDamageByEntityEvent(eventChange);
|
||||||
|
if (eventChange.isCancelled()) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) {
|
public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) {
|
||||||
onEntityDamageByEntityCommon(event.getDamager(), event.getEntity(), event.getCause(), event);
|
Entity damager = event.getDamager();
|
||||||
}
|
|
||||||
|
|
||||||
private void onEntityDamageByEntityCommon(
|
|
||||||
final Entity damager,
|
|
||||||
final Entity victim,
|
|
||||||
final EntityDamageEvent.DamageCause cause,
|
|
||||||
final Cancellable event
|
|
||||||
) {
|
|
||||||
Location location = BukkitUtil.adapt(damager.getLocation());
|
Location location = BukkitUtil.adapt(damager.getLocation());
|
||||||
if (!this.plotAreaManager.hasPlotArea(location.getWorldName())) {
|
if (!this.plotAreaManager.hasPlotArea(location.getWorldName())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!BukkitEntityUtil.entityDamage(damager, victim, cause)) {
|
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 (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
if (victim instanceof Ageable ageable) {
|
if (victim instanceof Ageable ageable) {
|
||||||
if (ageable.getAge() == -24000) {
|
if (ageable.getAge() == -24000) {
|
||||||
@ -152,13 +163,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;
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,6 @@ import com.plotsquared.core.plot.PlotWeather;
|
|||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.MathMan;
|
import com.plotsquared.core.util.MathMan;
|
||||||
import com.plotsquared.core.util.WorldUtil;
|
|
||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.world.item.ItemType;
|
import com.sk89q.worldedit.world.item.ItemType;
|
||||||
@ -121,9 +120,6 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canTeleport(final @NonNull Location location) {
|
public boolean canTeleport(final @NonNull Location location) {
|
||||||
if (!WorldUtil.isValidLocation(location)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final org.bukkit.Location to = BukkitUtil.adapt(location);
|
final org.bukkit.Location to = BukkitUtil.adapt(location);
|
||||||
final org.bukkit.Location from = player.getLocation();
|
final org.bukkit.Location from = player.getLocation();
|
||||||
PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to);
|
PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to);
|
||||||
@ -225,7 +221,7 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void teleport(final @NonNull Location location, final @NonNull TeleportCause cause) {
|
public void teleport(final @NonNull Location location, final @NonNull TeleportCause cause) {
|
||||||
if (!WorldUtil.isValidLocation(location)) {
|
if (Math.abs(location.getX()) >= 30000000 || Math.abs(location.getZ()) >= 30000000) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final org.bukkit.Location bukkitLocation =
|
final org.bukkit.Location bukkitLocation =
|
||||||
|
@ -20,6 +20,7 @@ package com.plotsquared.core.command;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.plotsquared.core.configuration.Settings;
|
import com.plotsquared.core.configuration.Settings;
|
||||||
|
import com.plotsquared.core.configuration.caption.StaticCaption;
|
||||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.permissions.Permission;
|
import com.plotsquared.core.permissions.Permission;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
@ -201,6 +202,7 @@ public class Download extends SubCommand {
|
|||||||
.tag("delete", Tag.preProcessParsed("Not available"))
|
.tag("delete", Tag.preProcessParsed("Not available"))
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
|
player.sendMessage(StaticCaption.of(value.toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
@ -268,7 +268,6 @@ public class MainCommand extends Command {
|
|||||||
tp = true;
|
tp = true;
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(TranslatableCaption.of("border.denied"));
|
player.sendMessage(TranslatableCaption.of("border.denied"));
|
||||||
return CompletableFuture.completedFuture(false);
|
|
||||||
}
|
}
|
||||||
// Trim command
|
// Trim command
|
||||||
args = Arrays.copyOfRange(args, 1, args.length);
|
args = Arrays.copyOfRange(args, 1, args.length);
|
||||||
|
@ -2574,12 +2574,6 @@ public class Plot {
|
|||||||
*/
|
*/
|
||||||
public void teleportPlayer(final PlotPlayer<?> player, TeleportCause cause, Consumer<Boolean> resultConsumer) {
|
public void teleportPlayer(final PlotPlayer<?> player, TeleportCause cause, Consumer<Boolean> resultConsumer) {
|
||||||
Plot plot = this.getBasePlot(false);
|
Plot plot = this.getBasePlot(false);
|
||||||
if (!WorldUtil.isValidLocation(plot.getBottomAbs())) {
|
|
||||||
// prevent from teleporting into unsafe regions
|
|
||||||
player.sendMessage(TranslatableCaption.of("border.denied"));
|
|
||||||
resultConsumer.accept(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
PlayerTeleportToPlotEvent event = this.eventDispatcher.callTeleport(player, player.getLocation(), plot, cause);
|
PlayerTeleportToPlotEvent event = this.eventDispatcher.callTeleport(player, player.getLocation(), plot, cause);
|
||||||
if (event.getEventResult() == Result.DENY) {
|
if (event.getEventResult() == Result.DENY) {
|
||||||
|
@ -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;
|
||||||
|
@ -551,7 +551,6 @@ public class EventDispatcher {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
default -> {
|
default -> {
|
||||||
}
|
}
|
||||||
|
@ -62,15 +62,6 @@ import java.util.zip.ZipOutputStream;
|
|||||||
|
|
||||||
public abstract class WorldUtil {
|
public abstract class WorldUtil {
|
||||||
|
|
||||||
/**
|
|
||||||
* {@return whether the given location is valid in the world}
|
|
||||||
* @param location the location to check
|
|
||||||
* @since TODO
|
|
||||||
*/
|
|
||||||
public static boolean isValidLocation(Location location) {
|
|
||||||
return Math.abs(location.getX()) < 30000000 && Math.abs(location.getZ()) < 30000000;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the biome in a region
|
* Set the biome in a region
|
||||||
*
|
*
|
||||||
|
@ -22,7 +22,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "com.intellectualsites.plotsquared"
|
group = "com.intellectualsites.plotsquared"
|
||||||
version = "7.3.6-SNAPSHOT"
|
version = "7.3.4-SNAPSHOT"
|
||||||
|
|
||||||
if (!File("$rootDir/.git").exists()) {
|
if (!File("$rootDir/.git").exists()) {
|
||||||
logger.lifecycle("""
|
logger.lifecycle("""
|
||||||
|
@ -13,7 +13,7 @@ log4j = "2.19.0"
|
|||||||
|
|
||||||
# Plugins
|
# Plugins
|
||||||
worldedit = "7.2.18"
|
worldedit = "7.2.18"
|
||||||
fawe = "2.9.0"
|
fawe = "2.8.4"
|
||||||
placeholderapi = "2.11.5"
|
placeholderapi = "2.11.5"
|
||||||
luckperms = "5.4"
|
luckperms = "5.4"
|
||||||
essentialsx = "2.20.1"
|
essentialsx = "2.20.1"
|
||||||
|
Reference in New Issue
Block a user