From ef83b5a1b7dce75f9383a060635efa2bdda1deca Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sat, 28 Apr 2018 09:28:55 +1000 Subject: [PATCH] Fixes #1931 --- .../com/plotsquared/bukkit/BukkitMain.java | 86 ++++++++++++++++--- .../bukkit/listeners/EntitySpawnListener.java | 2 +- .../plot/config/Settings.java | 2 + 3 files changed, 78 insertions(+), 12 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java index c5a71e0d2..bb004a234 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java @@ -1,5 +1,7 @@ package com.plotsquared.bukkit; +import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass; + import com.intellectualcrafters.configuration.ConfigurationSection; import com.intellectualcrafters.plot.IPlotMain; import com.intellectualcrafters.plot.PS; @@ -10,32 +12,94 @@ import com.intellectualcrafters.plot.generator.GeneratorWrapper; import com.intellectualcrafters.plot.generator.HybridGen; import com.intellectualcrafters.plot.generator.HybridUtils; import com.intellectualcrafters.plot.generator.IndependentPlotGenerator; -import com.intellectualcrafters.plot.object.*; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.object.PlotArea; +import com.intellectualcrafters.plot.object.PlotId; +import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.object.RunnableVal; +import com.intellectualcrafters.plot.object.SetupObject; import com.intellectualcrafters.plot.object.chat.PlainChatManager; import com.intellectualcrafters.plot.object.worlds.PlotAreaManager; import com.intellectualcrafters.plot.object.worlds.SinglePlotArea; import com.intellectualcrafters.plot.object.worlds.SinglePlotAreaManager; import com.intellectualcrafters.plot.object.worlds.SingleWorldGenerator; -import com.intellectualcrafters.plot.util.*; +import com.intellectualcrafters.plot.util.AbstractTitle; +import com.intellectualcrafters.plot.util.ChatManager; +import com.intellectualcrafters.plot.util.ChunkManager; +import com.intellectualcrafters.plot.util.ConsoleColors; +import com.intellectualcrafters.plot.util.EconHandler; +import com.intellectualcrafters.plot.util.EventUtil; +import com.intellectualcrafters.plot.util.InventoryUtil; +import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualcrafters.plot.util.ReflectionUtils; +import com.intellectualcrafters.plot.util.SchematicHandler; +import com.intellectualcrafters.plot.util.SetupUtils; +import com.intellectualcrafters.plot.util.StringMan; +import com.intellectualcrafters.plot.util.TaskManager; +import com.intellectualcrafters.plot.util.UUIDHandler; +import com.intellectualcrafters.plot.util.UUIDHandlerImplementation; +import com.intellectualcrafters.plot.util.WorldUtil; import com.intellectualcrafters.plot.util.block.QueueProvider; import com.intellectualcrafters.plot.uuid.UUIDWrapper; import com.plotsquared.bukkit.database.plotme.ClassicPlotMeConnector; import com.plotsquared.bukkit.database.plotme.LikePlotMeConverter; import com.plotsquared.bukkit.database.plotme.PlotMeConnector_017; import com.plotsquared.bukkit.generator.BukkitPlotGenerator; -import com.plotsquared.bukkit.listeners.*; +import com.plotsquared.bukkit.listeners.ChunkListener; +import com.plotsquared.bukkit.listeners.EntityPortal_1_7_9; +import com.plotsquared.bukkit.listeners.EntitySpawnListener; +import com.plotsquared.bukkit.listeners.PlayerEvents; +import com.plotsquared.bukkit.listeners.PlayerEvents183; +import com.plotsquared.bukkit.listeners.PlayerEvents_1_8; +import com.plotsquared.bukkit.listeners.PlayerEvents_1_9; +import com.plotsquared.bukkit.listeners.PlotPlusListener; +import com.plotsquared.bukkit.listeners.PlotPlusListener_1_12; +import com.plotsquared.bukkit.listeners.PlotPlusListener_Legacy; +import com.plotsquared.bukkit.listeners.SingleWorldListener; +import com.plotsquared.bukkit.listeners.WorldEvents; import com.plotsquared.bukkit.titles.DefaultTitle_111; -import com.plotsquared.bukkit.util.*; -import com.plotsquared.bukkit.util.block.*; -import com.plotsquared.bukkit.uuid.*; +import com.plotsquared.bukkit.util.BukkitChatManager; +import com.plotsquared.bukkit.util.BukkitChunkManager; +import com.plotsquared.bukkit.util.BukkitCommand; +import com.plotsquared.bukkit.util.BukkitEconHandler; +import com.plotsquared.bukkit.util.BukkitEventUtil; +import com.plotsquared.bukkit.util.BukkitHybridUtils; +import com.plotsquared.bukkit.util.BukkitInventoryUtil; +import com.plotsquared.bukkit.util.BukkitSchematicHandler; +import com.plotsquared.bukkit.util.BukkitSetupUtils; +import com.plotsquared.bukkit.util.BukkitTaskManager; +import com.plotsquared.bukkit.util.BukkitUtil; +import com.plotsquared.bukkit.util.BukkitVersion; +import com.plotsquared.bukkit.util.Metrics; +import com.plotsquared.bukkit.util.SendChunk; +import com.plotsquared.bukkit.util.SetGenCB; +import com.plotsquared.bukkit.util.block.BukkitLocalQueue; +import com.plotsquared.bukkit.util.block.BukkitLocalQueue_1_7; +import com.plotsquared.bukkit.util.block.BukkitLocalQueue_1_8; +import com.plotsquared.bukkit.util.block.BukkitLocalQueue_1_8_3; +import com.plotsquared.bukkit.util.block.BukkitLocalQueue_1_9; +import com.plotsquared.bukkit.uuid.DefaultUUIDWrapper; +import com.plotsquared.bukkit.uuid.FileUUIDHandler; +import com.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper; +import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper; +import com.plotsquared.bukkit.uuid.SQLUUIDHandler; import com.sk89q.worldedit.WorldEdit; import java.io.File; import java.lang.reflect.Field; import java.lang.reflect.Method; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; -import org.bukkit.*; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Chunk; import org.bukkit.Location; +import org.bukkit.OfflinePlayer; +import org.bukkit.World; import org.bukkit.command.PluginCommand; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; @@ -48,9 +112,6 @@ import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; - -import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass; - public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain { private static ConcurrentHashMap pluginMap; @@ -386,6 +447,9 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain case FIREBALL: case DRAGON_FIREBALL: case DROPPED_ITEM: + if (Settings.Enabled_Components.KILL_ROAD_ITEMS) { + entity.remove(); + } // dropped item continue; case PRIMED_TNT: diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/EntitySpawnListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/EntitySpawnListener.java index a61e260d3..32bebe45b 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/EntitySpawnListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/EntitySpawnListener.java @@ -31,7 +31,7 @@ public class EntitySpawnListener implements Listener { EntityType type = entity.getType(); switch (type) { case DROPPED_ITEM: - if (Settings.Enabled_Components.KILL_ROAD_MOBS) { + if (Settings.Enabled_Components.KILL_ROAD_ITEMS) { break; } case PLAYER: diff --git a/Core/src/main/java/com/intellectualcrafters/plot/config/Settings.java b/Core/src/main/java/com/intellectualcrafters/plot/config/Settings.java index f22cb4225..5c4bb0326 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/config/Settings.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/config/Settings.java @@ -321,6 +321,8 @@ public class Settings extends Config { public static boolean CHUNK_PROCESSOR = false; @Comment("Kill mobs on roads") public static boolean KILL_ROAD_MOBS = false; + @Comment("Kill items on roads") + public static boolean KILL_ROAD_ITEMS = false; @Comment("Kill vehicles on roads") public static boolean KILL_ROAD_VEHICLES = false; @Comment("Notify a player of any missed comments upon plot entry")