New Fake
This commit is contained in:
parent
251ff4da75
commit
1f426b48be
@ -1,9 +1,14 @@
|
|||||||
package com.massivecraft.massivecore;
|
package com.massivecraft.massivecore;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.bukkit.event.block.BlockMultiPlaceEvent;
|
||||||
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
|
import com.massivecraft.massivecore.predicate.PredicateStartsWithIgnoreCase;
|
||||||
|
|
||||||
public abstract class EngineAbstract implements Engine
|
public abstract class EngineAbstract implements Engine
|
||||||
{
|
{
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
@ -75,4 +80,23 @@ public abstract class EngineAbstract implements Engine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// FAKE
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
public static final PredicateStartsWithIgnoreCase STARTING_WITH_FAKE = PredicateStartsWithIgnoreCase.get("fake");
|
||||||
|
|
||||||
|
public static boolean isFake(Event event)
|
||||||
|
{
|
||||||
|
final Class<?> clazz = event.getClass();
|
||||||
|
if (event instanceof BlockPlaceEvent)
|
||||||
|
{
|
||||||
|
return ! BlockPlaceEvent.class.equals(clazz) && ! BlockMultiPlaceEvent.class.equals(clazz);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return STARTING_WITH_FAKE.apply(clazz.getSimpleName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,6 @@ import org.bukkit.entity.LivingEntity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Projectile;
|
import org.bukkit.entity.Projectile;
|
||||||
import org.bukkit.entity.ThrownPotion;
|
import org.bukkit.entity.ThrownPotion;
|
||||||
import org.bukkit.event.Event;
|
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
@ -68,7 +67,6 @@ import com.massivecraft.massivecore.engine.EngineMassiveCoreMain;
|
|||||||
import com.massivecraft.massivecore.engine.EngineMassiveCoreWorldNameSet;
|
import com.massivecraft.massivecore.engine.EngineMassiveCoreWorldNameSet;
|
||||||
import com.massivecraft.massivecore.nms.NmsEntity;
|
import com.massivecraft.massivecore.nms.NmsEntity;
|
||||||
import com.massivecraft.massivecore.predicate.Predicate;
|
import com.massivecraft.massivecore.predicate.Predicate;
|
||||||
import com.massivecraft.massivecore.predicate.PredicateStartsWithIgnoreCase;
|
|
||||||
import com.massivecraft.massivecore.util.extractor.Extractor;
|
import com.massivecraft.massivecore.util.extractor.Extractor;
|
||||||
import com.massivecraft.massivecore.util.extractor.ExtractorPlayer;
|
import com.massivecraft.massivecore.util.extractor.ExtractorPlayer;
|
||||||
import com.massivecraft.massivecore.util.extractor.ExtractorPlayerName;
|
import com.massivecraft.massivecore.util.extractor.ExtractorPlayerName;
|
||||||
@ -754,17 +752,6 @@ public class MUtil
|
|||||||
throw new IllegalArgumentException("The dye color " + dyeColor + " is not yet supported!");
|
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
|
// ENTITY DAMAGE EVENT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
Loading…
Reference in New Issue
Block a user