From 4395ca06b478bea5e366360201683cead173fd18 Mon Sep 17 00:00:00 2001 From: sauilitired Date: Thu, 15 Nov 2018 00:12:12 +0100 Subject: [PATCH] Add @SuppressWarnings("unused") to listeners. --- .../plotsquared/bukkit/listeners/ChunkListener.java | 1 + .../bukkit/listeners/EntityPortal_1_7_9.java | 1 + .../bukkit/listeners/EntitySpawnListener.java | 1 + .../bukkit/listeners/ForceFieldListener.java | 1 + .../plotsquared/bukkit/listeners/PlayerEvents.java | 1 + .../plotsquared/bukkit/listeners/PlayerEvents183.java | 11 ++++------- .../bukkit/listeners/PlayerEvents_1_8.java | 1 + .../bukkit/listeners/PlayerEvents_1_9.java | 1 + .../bukkit/listeners/PlotPlusListener.java | 1 + .../bukkit/listeners/PlotPlusListener_1_12.java | 2 ++ .../bukkit/listeners/PlotPlusListener_Legacy.java | 2 ++ .../bukkit/listeners/SingleWorldListener.java | 1 + .../plotsquared/bukkit/listeners/WorldEvents.java | 2 +- .../plotsquared/nukkit/listeners/PlayerEvents.java | 1 + .../plotsquared/nukkit/listeners/WorldEvents.java | 1 + 15 files changed, 20 insertions(+), 8 deletions(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java index 7f38b7c79..5965d612c 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java @@ -32,6 +32,7 @@ import java.util.HashSet; import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getRefClass; +@SuppressWarnings("unused") public class ChunkListener implements Listener { private RefMethod methodGetHandleChunk; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntityPortal_1_7_9.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntityPortal_1_7_9.java index 754301598..cfefc7a17 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntityPortal_1_7_9.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntityPortal_1_7_9.java @@ -18,6 +18,7 @@ import org.bukkit.plugin.Plugin; import java.util.List; +@SuppressWarnings("unused") public class EntityPortal_1_7_9 implements Listener { private static boolean ignoreTP = false; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java index 8f8a4db18..60e668935 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java @@ -16,6 +16,7 @@ import org.bukkit.event.entity.EntitySpawnEvent; import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.plugin.Plugin; +@SuppressWarnings("unused") public class EntitySpawnListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void creatureSpawnEvent(EntitySpawnEvent event) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ForceFieldListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ForceFieldListener.java index 0eeae748f..81c720b13 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ForceFieldListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ForceFieldListener.java @@ -16,6 +16,7 @@ import java.util.HashSet; import java.util.Set; import java.util.UUID; +@SuppressWarnings("unused") public class ForceFieldListener { private static Set getNearbyPlayers(Player player, Plot plot) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java index cba6e2929..fade7cdc2 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java @@ -56,6 +56,7 @@ import java.util.regex.Pattern; /** * Player Events involving plots. */ +@SuppressWarnings("unused") public class PlayerEvents extends PlotListener implements Listener { private boolean pistonBlocks = true; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents183.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents183.java index 4ea390f14..6d1ce0ded 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents183.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents183.java @@ -14,7 +14,9 @@ import org.bukkit.event.block.BlockExplodeEvent; import java.util.Iterator; +@SuppressWarnings("unused") public class PlayerEvents183 implements Listener { + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBigBoom(BlockExplodeEvent event) { Block block = event.getBlock(); @@ -38,12 +40,7 @@ public class PlayerEvents183 implements Listener { if (plot == null || !plot.getFlag(Flags.EXPLOSION).or(false)) { event.setCancelled(true); } - Iterator iterator = event.blockList().iterator(); - while (iterator.hasNext()) { - Block b = iterator.next(); - if (!plot.equals(area.getOwnedPlot(BukkitUtil.getLocation(b.getLocation())))) { - iterator.remove(); - } - } + event.blockList().removeIf( + b -> !plot.equals(area.getOwnedPlot(BukkitUtil.getLocation(b.getLocation())))); } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents_1_8.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents_1_8.java index 1fa202b7a..791d862fa 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents_1_8.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents_1_8.java @@ -32,6 +32,7 @@ import java.util.HashSet; import java.util.List; import java.util.UUID; +@SuppressWarnings("unused") public class PlayerEvents_1_8 extends PlotListener implements Listener { @SuppressWarnings("deprecation") diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents_1_9.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents_1_9.java index 4bd896479..c89892749 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents_1_9.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents_1_9.java @@ -9,6 +9,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.entity.LingeringPotionSplashEvent; +@SuppressWarnings("unused") public class PlayerEvents_1_9 implements Listener { private final PlayerEvents parent; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener.java index 87bea7b24..9d37ef09e 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener.java @@ -28,6 +28,7 @@ import java.util.Iterator; import java.util.Map.Entry; import java.util.UUID; +@SuppressWarnings("unused") public class PlotPlusListener extends PlotListener implements Listener { private static final HashMap feedRunnable = new HashMap<>(); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener_1_12.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener_1_12.java index ed8d2245c..47b2e90fa 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener_1_12.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener_1_12.java @@ -12,7 +12,9 @@ import org.bukkit.event.entity.EntityPickupItemEvent; import java.util.UUID; +@SuppressWarnings("unused") public class PlotPlusListener_1_12 implements Listener { + @EventHandler public void onItemPickup(EntityPickupItemEvent event) { LivingEntity ent = event.getEntity(); if (ent instanceof Player) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener_Legacy.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener_Legacy.java index 2ba21e19a..fdd762c45 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener_Legacy.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener_Legacy.java @@ -11,7 +11,9 @@ import org.bukkit.event.player.PlayerPickupItemEvent; import java.util.UUID; +@SuppressWarnings("unused") public class PlotPlusListener_Legacy implements Listener { + @EventHandler public void onItemPickup(PlayerPickupItemEvent event) { Player player = event.getPlayer(); PlotPlayer pp = BukkitUtil.getPlayer(player); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java index e67310d4b..de02bb5db 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/SingleWorldListener.java @@ -19,6 +19,7 @@ import java.lang.reflect.Method; import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getRefClass; +@SuppressWarnings("unused") public class SingleWorldListener implements Listener { private Method methodGetHandleChunk; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/WorldEvents.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/WorldEvents.java index 7b7f203f5..98d6c0f5a 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/WorldEvents.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/WorldEvents.java @@ -12,7 +12,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.world.WorldInitEvent; import org.bukkit.generator.ChunkGenerator; -public class WorldEvents implements Listener { +@SuppressWarnings("unused") public class WorldEvents implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onWorldInit(WorldInitEvent event) { diff --git a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/listeners/PlayerEvents.java b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/listeners/PlayerEvents.java index 6aa14cd11..2d87746d6 100644 --- a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/listeners/PlayerEvents.java +++ b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/listeners/PlayerEvents.java @@ -36,6 +36,7 @@ import java.util.*; import java.util.Map.Entry; import java.util.regex.Pattern; +@SuppressWarnings("unused") public class PlayerEvents extends PlotListener implements Listener { private boolean pistonBlocks = true; diff --git a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/listeners/WorldEvents.java b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/listeners/WorldEvents.java index aba6fdf7c..aa7cd763d 100644 --- a/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/listeners/WorldEvents.java +++ b/Nukkit/src/main/java/com/github/intellectualsites/plotsquared/nukkit/listeners/WorldEvents.java @@ -14,6 +14,7 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import java.util.HashMap; +@SuppressWarnings("unused") public class WorldEvents implements Listener { public WorldEvents() {