Added Fake Event check (#4296)

Thanks you @TheBusyBiscuit
This commit is contained in:
TheBusyBiscuit
2020-10-14 21:11:15 +02:00
committed by GitHub
parent 8d6d0cf254
commit f29370a1c8
10 changed files with 42 additions and 9 deletions

View File

@ -7,7 +7,7 @@ import org.bukkit.event.block.BlockBreakEvent;
/**
* Called when mcMMO breaks a block due to a special ability.
*/
public class FakeBlockBreakEvent extends BlockBreakEvent {
public class FakeBlockBreakEvent extends BlockBreakEvent implements FakeEvent {
public FakeBlockBreakEvent(Block theBlock, Player player) {
super(theBlock, player);
}

View File

@ -8,7 +8,7 @@ import org.bukkit.inventory.ItemStack;
/**
* Called when mcMMO damages a block due to a special ability.
*/
public class FakeBlockDamageEvent extends BlockDamageEvent {
public class FakeBlockDamageEvent extends BlockDamageEvent implements FakeEvent {
public FakeBlockDamageEvent(Player player, Block block, ItemStack itemInHand, boolean instaBreak) {
super(player, block, itemInHand, instaBreak);
}

View File

@ -4,7 +4,7 @@ import org.bukkit.block.Block;
import org.bukkit.event.inventory.BrewEvent;
import org.bukkit.inventory.BrewerInventory;
public class FakeBrewEvent extends BrewEvent {
public class FakeBrewEvent extends BrewEvent implements FakeEvent {
public FakeBrewEvent(Block brewer, BrewerInventory contents, int fuelLevel) {
super(brewer, contents, fuelLevel);
}

View File

@ -11,7 +11,7 @@ import java.util.Map;
/**
* Called when mcMMO applies damage from an entity due to special abilities.
*/
public class FakeEntityDamageByEntityEvent extends EntityDamageByEntityEvent {
public class FakeEntityDamageByEntityEvent extends EntityDamageByEntityEvent implements FakeEvent {
public FakeEntityDamageByEntityEvent(Entity damager, Entity damagee, DamageCause cause, final Map<DamageModifier, Double> modifiers) {
super(damager, damagee, cause, modifiers, getFunctionModifiers(modifiers));

View File

@ -11,7 +11,7 @@ import java.util.Map;
/**
* Called when mcMMO applies damage due to special abilities.
*/
public class FakeEntityDamageEvent extends EntityDamageEvent {
public class FakeEntityDamageEvent extends EntityDamageEvent implements FakeEvent {
public FakeEntityDamageEvent(Entity damagee, DamageCause cause, final Map<DamageModifier, Double> modifiers) {
super(damagee, cause, modifiers, getFunctionModifiers(modifiers));

View File

@ -7,7 +7,7 @@ import org.bukkit.event.entity.EntityTameEvent;
/**
* Called when mcMMO tames an animal via Call of the Wild
*/
public class FakeEntityTameEvent extends EntityTameEvent {
public class FakeEntityTameEvent extends EntityTameEvent implements FakeEvent {
public FakeEntityTameEvent(LivingEntity entity, AnimalTamer owner) {
super(entity, owner);
}

View File

@ -0,0 +1,11 @@
package com.gmail.nossr50.events.fake;
import org.bukkit.event.Event;
/**
* This interface marks an {@link Event} as "fake".
* This is just a handy way of checking if an {@link Event} is fake or not, maybe there
* will be methods suitable for this in the future.
*
*/
public interface FakeEvent {}

View File

@ -6,7 +6,7 @@ import org.bukkit.event.player.PlayerAnimationEvent;
/**
* Called when handling extra drops to avoid issues with NoCheat.
*/
public class FakePlayerAnimationEvent extends PlayerAnimationEvent {
public class FakePlayerAnimationEvent extends PlayerAnimationEvent implements FakeEvent {
public FakePlayerAnimationEvent(Player player) {
super(player);
}

View File

@ -5,7 +5,7 @@ import org.bukkit.entity.FishHook;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerFishEvent;
public class FakePlayerFishEvent extends PlayerFishEvent {
public class FakePlayerFishEvent extends PlayerFishEvent implements FakeEvent {
public FakePlayerFishEvent(Player player, Entity entity, FishHook hookEntity, State state) {
super(player, entity, hookEntity, state);
}