allow "owned" road mobs to be killed as well

(those that are leashed, being ridden, etc)
This commit is contained in:
dordsor21 2020-12-10 21:14:32 +00:00
parent 540f4c0958
commit b4f3e85001
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B
2 changed files with 8 additions and 3 deletions

View File

@ -898,9 +898,11 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
if (BukkitUtil.adapt(location).isPlotRoad()) { if (BukkitUtil.adapt(location).isPlotRoad()) {
if (entity instanceof LivingEntity) { if (entity instanceof LivingEntity) {
LivingEntity livingEntity = (LivingEntity) entity; LivingEntity livingEntity = (LivingEntity) entity;
if (!livingEntity.isLeashed() || !entity.hasMetadata("keep")) { if ((Settings.Enabled_Components.KILL_OWNED_ROAD_MOBS || !livingEntity.isLeashed())
|| !entity.hasMetadata("keep")) {
Entity passenger = entity.getPassenger(); Entity passenger = entity.getPassenger();
if (!(passenger instanceof Player) && entity.getMetadata("keep").isEmpty()) { if ((Settings.Enabled_Components.KILL_OWNED_ROAD_MOBS
|| !(passenger instanceof Player)) && entity.getMetadata("keep").isEmpty()) {
if (entity.hasMetadata("ps-tmp-teleport")) { if (entity.hasMetadata("ps-tmp-teleport")) {
continue; continue;
} }
@ -911,7 +913,8 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
} }
} else { } else {
Entity passenger = entity.getPassenger(); Entity passenger = entity.getPassenger();
if (!(passenger instanceof Player) && entity.getMetadata("keep").isEmpty()) { if ((Settings.Enabled_Components.KILL_OWNED_ROAD_MOBS
|| !(passenger instanceof Player)) && entity.getMetadata("keep").isEmpty()) {
if (entity.hasMetadata("ps-tmp-teleport")) { if (entity.hasMetadata("ps-tmp-teleport")) {
continue; continue;
} }

View File

@ -615,6 +615,8 @@ public class Settings extends Config {
@Comment("Processes chunks (trimming, or entity/tile limits) ") public static boolean @Comment("Processes chunks (trimming, or entity/tile limits) ") public static boolean
CHUNK_PROCESSOR = false; CHUNK_PROCESSOR = false;
@Comment("Kill mobs on roads (Chicken, Cow, etc.)") public static boolean KILL_ROAD_MOBS = false; @Comment("Kill mobs on roads (Chicken, Cow, etc.)") public static boolean KILL_ROAD_MOBS = false;
@Comment("Also kill any road mobs that are being ridden, or are leashed") public static boolean
KILL_OWNED_ROAD_MOBS = false;
@Comment("Kill items on roads (Stick, Paper, etc.)") public static boolean KILL_ROAD_ITEMS = false; @Comment("Kill items on roads (Stick, Paper, etc.)") public static boolean KILL_ROAD_ITEMS = false;
@Comment("Kill vehicles on roads (Boat, Minecart, etc.)") public static boolean KILL_ROAD_VEHICLES = false; @Comment("Kill vehicles on roads (Boat, Minecart, etc.)") public static boolean KILL_ROAD_VEHICLES = false;
@Comment("Notify a player of any missed plot comments upon plot entry") public static boolean @Comment("Notify a player of any missed plot comments upon plot entry") public static boolean