Don't kill owned road entities (leashed / named) (#3829)

This commit is contained in:
BlockyTheDev 2022-10-10 18:41:25 +02:00 committed by GitHub
parent 3effaefda7
commit d5445cfbef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 5 deletions

View File

@ -849,11 +849,11 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
// managed elsewhere
continue;
case "SHULKER":
if (Settings.Enabled_Components.KILL_ROAD_MOBS) {
if (Settings.Enabled_Components.KILL_ROAD_MOBS && (Settings.Enabled_Components.KILL_NAMED_ROAD_MOBS || entity.getCustomName() == null)) {
LivingEntity livingEntity = (LivingEntity) entity;
List<MetadataValue> meta = entity.getMetadata("shulkerPlot");
if (!meta.isEmpty()) {
if (livingEntity.isLeashed()) {
if (livingEntity.isLeashed() && !Settings.Enabled_Components.KILL_OWNED_ROAD_MOBS) {
continue;
}
List<MetadataValue> keep = entity.getMetadata("keep");
@ -973,7 +973,9 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|| !entity.hasMetadata("keep")) {
Entity passenger = entity.getPassenger();
if ((Settings.Enabled_Components.KILL_OWNED_ROAD_MOBS
|| !(passenger instanceof Player)) && entity.getMetadata("keep").isEmpty()) {
|| !((passenger instanceof Player) || livingEntity.isLeashed()))
&& (Settings.Enabled_Components.KILL_NAMED_ROAD_MOBS || entity.getCustomName() == null)
&& entity.getMetadata("keep").isEmpty()) {
if (entity.hasMetadata("ps-tmp-teleport")) {
continue;
}
@ -983,8 +985,9 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
}
} else {
Entity passenger = entity.getPassenger();
if ((Settings.Enabled_Components.KILL_OWNED_ROAD_MOBS
|| !(passenger instanceof Player)) && entity.getMetadata("keep").isEmpty()) {
if ((Settings.Enabled_Components.KILL_OWNED_ROAD_MOBS || !(passenger instanceof Player))
&& (Settings.Enabled_Components.KILL_NAMED_ROAD_MOBS && entity.getCustomName() != null)
&& entity.getMetadata("keep").isEmpty()) {
if (entity.hasMetadata("ps-tmp-teleport")) {
continue;
}

View File

@ -759,6 +759,8 @@ public class Settings extends Config {
@Comment("Also kill any road mobs that are being ridden, or are leashed")
public static boolean
KILL_OWNED_ROAD_MOBS = false;
@Comment("Also kill any road mobs that are named")
public static boolean KILL_NAMED_ROAD_MOBS = false;
@Comment("Kill items on roads (Stick, Paper, etc.)")
public static boolean KILL_ROAD_ITEMS = false;
@Comment("Kill vehicles on roads (Boat, Minecart, etc.)")