From 8dbded4192dff9ca30e004d23825bcc451523167 Mon Sep 17 00:00:00 2001 From: ulumulu1510 Date: Sun, 17 Jan 2016 17:57:48 +0100 Subject: [PATCH] Implement isFakeEvent into MUtil. --- .../massivecraft/massivecore/util/MUtil.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/com/massivecraft/massivecore/util/MUtil.java b/src/com/massivecraft/massivecore/util/MUtil.java index 853f0fcd..c3fb3739 100644 --- a/src/com/massivecraft/massivecore/util/MUtil.java +++ b/src/com/massivecraft/massivecore/util/MUtil.java @@ -24,6 +24,7 @@ import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; +import com.massivecraft.massivecore.PredicateStartsWithIgnoreCase; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.DyeColor; @@ -39,6 +40,7 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; import org.bukkit.entity.ThrownPotion; +import org.bukkit.event.Event; import org.bukkit.event.block.Action; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; @@ -87,7 +89,7 @@ public class MUtil { methodGetOnlinePlayers = getMethodGetOnlinePlayers(); } - + // -------------------------------------------- // // GET ONLINE PLAYERS // -------------------------------------------- // @@ -673,7 +675,18 @@ public class MUtil } throw new IllegalArgumentException("The dye color " + dyeColor + " is not yet supported!"); } - + + // -------------------------------------------- // + // FAKE EVENT + // -------------------------------------------- // + + public static final PredicateStartsWithIgnoreCase STARTING_WITH_FAKE = PredicateStartsWithIgnoreCase.get("fake"); + + public static boolean isFakeEvent(Event event) + { + return STARTING_WITH_FAKE.apply(event.getClass().getSimpleName()); + } + // -------------------------------------------- // // ENTITY DAMAGE EVENT // -------------------------------------------- //