use of de.hglabor.plugins.kitapi.kit.events.KitEvent in project kit-api by HGLabor.
the class FahrradKit method onPlayerLeftClickKitItem.
@KitEvent
public void onPlayerLeftClickKitItem(PlayerInteractEvent event, KitPlayer kitPlayer) {
Player player = event.getPlayer();
if (player.isInsideVehicle()) {
player.sendMessage(ChatColor.RED + "Du befindest dich bereits in einem Fahrzeug");
return;
}
BukkitUtils.playSound(player, Sound.BLOCK_CHAIN_PLACE);
Horse horse = player.getWorld().spawn(player.getLocation(), Horse.class);
horse.setOwner(player);
horse.getInventory().setSaddle(new ItemStack(Material.SADDLE));
horse.setCustomName("Fahrrad von " + player.getName());
horse.setCustomNameVisible(true);
horse.setMetadata(fahrradOwner, new FixedMetadataValue(KitApi.getInstance().getPlugin(), player.getUniqueId()));
kitPlayer.putKitAttribute(fahrradId, horse.getUniqueId());
horse.addPassenger(player);
}
use of de.hglabor.plugins.kitapi.kit.events.KitEvent in project kit-api by HGLabor.
the class FalcoKit method onPlayerRightClickKitItem.
@KitEvent
@Override
public void onPlayerRightClickKitItem(PlayerInteractEvent event, KitPlayer kitPlayer) {
kitPlayer.getBukkitPlayer().ifPresent(it -> {
Phantom phantom = it.getWorld().spawn(it.getLocation(), Phantom.class);
phantom.setShouldBurnInDay(false);
phantom.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, Integer.MAX_VALUE, 25, false, false));
phantom.setVelocity(it.getLocation().getDirection().multiply(2));
AtomicInteger tick = new AtomicInteger();
Bukkit.getScheduler().runTaskLater(KitApi.getInstance().getPlugin(), () -> {
phantom.getWorld().playSound(phantom.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 1f, 10f);
}, 40);
Bukkit.getScheduler().runTaskTimer(KitApi.getInstance().getPlugin(), task -> {
tick.getAndIncrement();
if (tick.get() == flashDuration) {
task.cancel();
phantom.remove();
} else {
for (Entity nearby : phantom.getNearbyEntities(flashRadius, flashRadius, flashRadius)) {
nearby.getWorld().spawnParticle(Particle.FLASH, nearby.getLocation().clone().add(0, 1, 0), 0);
}
}
}, 40, 1);
});
kitPlayer.activateKitCooldown(this);
}
use of de.hglabor.plugins.kitapi.kit.events.KitEvent in project kit-api by HGLabor.
the class FrostyKit method onPlayerMoveEvent.
@KitEvent
@Override
public void onPlayerMoveEvent(PlayerMoveEvent event, KitPlayer kitPlayer) {
Player player = event.getPlayer();
Material type = player.getLocation().clone().subtract(0, 1, 0).getBlock().getType();
if (type == Material.SNOW_BLOCK || type == Material.SNOW) {
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 20, potionAmpflier));
player.setFreezeTicks(60);
}
}
use of de.hglabor.plugins.kitapi.kit.events.KitEvent in project kit-api by HGLabor.
the class GamblerKit method onPlayerRightClickKitItem.
@KitEvent
@Override
public void onPlayerRightClickKitItem(PlayerInteractEvent event, KitPlayer kitPlayer) {
Player player = event.getPlayer();
int tick = 2;
kitPlayer.activateKitCooldown(this);
GambleWin gambleWin = new GambleWin(kitPlayer, player, 3, tick);
kitPlayer.putKitAttribute(attributeKey, gambleWin);
gambleWin.runTaskTimer(KitApi.getInstance().getPlugin(), 0, tick);
}
use of de.hglabor.plugins.kitapi.kit.events.KitEvent in project kit-api by HGLabor.
the class GhostKit method onPlayerMoveEvent.
@KitEvent(ignoreCooldown = true)
@Override
public void onPlayerMoveEvent(PlayerMoveEvent event, KitPlayer kitPlayer) {
if (kitPlayer.getKitAttributeOrDefault(isGhostModeKey, false)) {
Player player = event.getPlayer();
player.getWorld().spawnParticle(this.particle, player.getLocation(), this.trailParticleAmount);
}
}
Aggregations