diff --git a/src/main/java/ch/njol/skript/classes/data/BukkitEventValues.java b/src/main/java/ch/njol/skript/classes/data/BukkitEventValues.java index f7576e07f2b..b4b9fce7726 100644 --- a/src/main/java/ch/njol/skript/classes/data/BukkitEventValues.java +++ b/src/main/java/ch/njol/skript/classes/data/BukkitEventValues.java @@ -18,16 +18,7 @@ */ package ch.njol.skript.classes.data; -import java.time.Duration; -import java.time.temporal.TemporalAmount; -import java.time.temporal.TemporalUnit; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - import ch.njol.skript.Skript; -import ch.njol.skript.aliases.Aliases; import ch.njol.skript.aliases.ItemType; import ch.njol.skript.bukkitutil.InventoryUtils; import ch.njol.skript.command.CommandEvent; @@ -35,13 +26,7 @@ import ch.njol.skript.events.bukkit.SkriptStartEvent; import ch.njol.skript.events.bukkit.SkriptStopEvent; import ch.njol.skript.registrations.EventValues; -import ch.njol.skript.util.BlockStateBlock; -import ch.njol.skript.util.BlockUtils; -import ch.njol.skript.util.DelayedChangeBlock; -import ch.njol.skript.util.Direction; -import ch.njol.skript.util.EnchantmentType; -import ch.njol.skript.util.Getter; -import ch.njol.skript.util.Timespan; +import ch.njol.skript.util.*; import ch.njol.skript.util.slot.InventorySlot; import ch.njol.skript.util.slot.Slot; import com.destroystokyo.paper.event.block.AnvilDamagedEvent; @@ -50,150 +35,47 @@ import com.destroystokyo.paper.event.entity.ProjectileCollideEvent; import com.destroystokyo.paper.event.player.PlayerArmorChangeEvent; import io.papermc.paper.event.entity.EntityMoveEvent; -import io.papermc.paper.event.player.PlayerStopUsingItemEvent; -import io.papermc.paper.event.player.PlayerInventorySlotChangeEvent; -import io.papermc.paper.event.player.PlayerStonecutterRecipeSelectEvent; -import io.papermc.paper.event.player.PlayerTradeEvent; -import io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent; -import org.bukkit.Bukkit; -import org.bukkit.Chunk; -import org.bukkit.FireworkEffect; -import org.bukkit.GameMode; -import org.bukkit.Keyed; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.World; +import io.papermc.paper.event.player.*; +import org.bukkit.*; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; import org.bukkit.block.data.BlockData; -import org.bukkit.event.block.BlockDropItemEvent; import org.bukkit.command.CommandSender; -import org.bukkit.entity.AbstractVillager; -import org.bukkit.entity.AreaEffectCloud; -import org.bukkit.entity.Egg; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Firework; -import org.bukkit.entity.Hanging; -import org.bukkit.entity.HumanEntity; -import org.bukkit.entity.Item; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Projectile; -import org.bukkit.entity.Vehicle; -import org.bukkit.event.Event; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockCanBuildEvent; -import org.bukkit.event.block.BlockDamageEvent; -import org.bukkit.event.block.BlockDispenseEvent; -import org.bukkit.event.block.BlockEvent; -import org.bukkit.event.block.BlockFadeEvent; -import org.bukkit.event.block.BlockFertilizeEvent; -import org.bukkit.event.block.BlockFromToEvent; -import org.bukkit.event.block.BlockGrowEvent; -import org.bukkit.event.block.BlockIgniteEvent; -import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.block.SignChangeEvent; -import org.bukkit.event.block.BellRingEvent; -import org.bukkit.event.block.BellResonateEvent; +import org.bukkit.entity.*; +import org.bukkit.event.block.*; import org.bukkit.event.enchantment.EnchantItemEvent; import org.bukkit.event.enchantment.PrepareItemEnchantEvent; -import org.bukkit.event.entity.AreaEffectCloudApplyEvent; -import org.bukkit.event.entity.CreatureSpawnEvent; +import org.bukkit.event.entity.*; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; -import org.bukkit.event.entity.EntityChangeBlockEvent; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.entity.EntityDeathEvent; -import org.bukkit.event.entity.EntityDropItemEvent; -import org.bukkit.event.entity.EntityEvent; -import org.bukkit.event.entity.EntityPickupItemEvent; -import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; -import org.bukkit.event.entity.EntityResurrectEvent; -import org.bukkit.event.entity.EntityTameEvent; -import org.bukkit.event.entity.EntityTeleportEvent; -import org.bukkit.event.entity.EntityTransformEvent; import org.bukkit.event.entity.EntityTransformEvent.TransformReason; -import org.bukkit.event.entity.EntityPotionEffectEvent; -import org.bukkit.event.entity.FireworkExplodeEvent; -import org.bukkit.event.entity.HorseJumpEvent; -import org.bukkit.event.entity.ItemDespawnEvent; -import org.bukkit.event.entity.ItemMergeEvent; -import org.bukkit.event.entity.ItemSpawnEvent; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.event.hanging.HangingBreakByEntityEvent; import org.bukkit.event.hanging.HangingBreakEvent; import org.bukkit.event.hanging.HangingEvent; import org.bukkit.event.hanging.HangingPlaceEvent; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.event.inventory.CraftItemEvent; -import org.bukkit.event.inventory.DragType; -import org.bukkit.event.inventory.InventoryAction; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.inventory.InventoryCloseEvent; -import org.bukkit.event.inventory.InventoryDragEvent; -import org.bukkit.event.inventory.InventoryMoveItemEvent; -import org.bukkit.event.inventory.InventoryOpenEvent; -import org.bukkit.event.inventory.InventoryPickupItemEvent; -import org.bukkit.event.inventory.PrepareAnvilEvent; -import org.bukkit.event.inventory.PrepareItemCraftEvent; -import org.bukkit.event.player.PlayerBedEnterEvent; -import org.bukkit.event.player.PlayerBedLeaveEvent; -import org.bukkit.event.player.PlayerBucketEmptyEvent; -import org.bukkit.event.player.PlayerBucketFillEvent; -import org.bukkit.event.player.PlayerChangedWorldEvent; -import org.bukkit.event.player.PlayerDropItemEvent; -import org.bukkit.event.player.PlayerEditBookEvent; -import org.bukkit.event.player.PlayerEggThrowEvent; -import org.bukkit.event.player.PlayerEvent; -import org.bukkit.event.player.PlayerInteractEntityEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerItemBreakEvent; -import org.bukkit.event.player.PlayerItemConsumeEvent; -import org.bukkit.event.player.PlayerItemDamageEvent; -import org.bukkit.event.player.PlayerItemHeldEvent; -import org.bukkit.event.player.PlayerItemMendEvent; -import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.event.player.PlayerPickupArrowEvent; -import org.bukkit.event.player.PlayerPickupItemEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.player.PlayerExpCooldownChangeEvent; +import org.bukkit.event.inventory.*; +import org.bukkit.event.player.*; import org.bukkit.event.player.PlayerExpCooldownChangeEvent.ChangeReason; import org.bukkit.event.player.PlayerQuitEvent.QuitReason; -import org.bukkit.event.player.PlayerRiptideEvent; -import org.bukkit.event.player.PlayerShearEntityEvent; -import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; -import org.bukkit.event.player.PlayerToggleFlightEvent; import org.bukkit.event.server.ServerCommandEvent; -import org.bukkit.event.vehicle.VehicleDamageEvent; -import org.bukkit.event.vehicle.VehicleDestroyEvent; -import org.bukkit.event.vehicle.VehicleEnterEvent; -import org.bukkit.event.vehicle.VehicleEvent; -import org.bukkit.event.vehicle.VehicleExitEvent; +import org.bukkit.event.vehicle.*; import org.bukkit.event.weather.LightningStrikeEvent; import org.bukkit.event.weather.WeatherEvent; -import org.bukkit.event.world.ChunkEvent; -import org.bukkit.event.world.LootGenerateEvent; -import org.bukkit.event.world.PortalCreateEvent; -import org.bukkit.event.world.StructureGrowEvent; -import org.bukkit.event.world.WorldEvent; -import org.bukkit.inventory.EntityEquipment; -import org.bukkit.inventory.EquipmentSlot; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.InventoryView; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.PlayerInventory; -import org.bukkit.inventory.Recipe; +import org.bukkit.event.world.*; +import org.bukkit.inventory.*; import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionData; import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionType; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + /** * @author Peter Güttinger */ @@ -1899,8 +1781,7 @@ public TransformReason get(EntityTransformEvent event) { if (Skript.classExists("org.bukkit.event.block.BellRingEvent")) { EventValues.registerEventValue(BellRingEvent.class, Entity.class, new Getter() { @Override - @Nullable - public Entity get(BellRingEvent event) { + public @Nullable Entity get(BellRingEvent event) { return event.getEntity(); } }, EventValues.TIME_NOW); diff --git a/src/main/java/ch/njol/skript/events/EvtBeaconEffect.java b/src/main/java/ch/njol/skript/events/EvtBeaconEffect.java index f0efdb7cb58..c141de98706 100644 --- a/src/main/java/ch/njol/skript/events/EvtBeaconEffect.java +++ b/src/main/java/ch/njol/skript/events/EvtBeaconEffect.java @@ -1,8 +1,6 @@ package ch.njol.skript.events; import ch.njol.skript.Skript; -import ch.njol.skript.aliases.ItemType; -import ch.njol.skript.classes.data.DefaultComparators; import ch.njol.skript.doc.*; import ch.njol.skript.lang.Literal; import ch.njol.skript.lang.SkriptEvent; @@ -11,7 +9,6 @@ import org.bukkit.event.Event; import org.bukkit.potion.PotionEffectType; import org.jetbrains.annotations.Nullable; -import org.skriptlang.skript.lang.comparator.Relation; @Name("Beacon Effect") @Description("Called when a player gets an effect from a beacon.") @@ -58,9 +55,8 @@ public boolean check(Event event) { return false; if (primaryCheck != null && effectEvent.isPrimary() != primaryCheck) return false; - if (potionTypes != null) { + if (potionTypes != null) return potionTypes.check(event, type -> effectEvent.getEffect().getType() == type); - } return true; }