Is there a method for Knockback? Like I want to cancel player knockback when something explodes, How would I do this?
I cannot recall any such way but you can start a delayed task that will teleport player to the location he was on the time of hit after 20 ticks (1sec) so even if teleported, he is ran back on the place of hit
mine-care Alright so Its for a ExplosivePick plugin, Here is my code. Would I add it to BlockBreak or EntityDamage? (Have not really used Delayed tasks) Code:java package me.nite.main; import java.util.ArrayList;import org.bukkit.entity.Player;import org.bukkit.event.EventHandler;import org.bukkit.event.Listener;import org.bukkit.event.block.BlockBreakEvent;import org.bukkit.event.entity.EntityDamageEvent; public class BlockBreak implements Listener {private Main plugin; public BlockBreak(Main instance) {this.plugin = instance;} ArrayList<Player> list = new ArrayList(); @EventHandlerpublic void onBlockBreak(BlockBreakEvent e) {if (e.getPlayer().getItemInHand().getItemMeta().getLore().equals("ยง7Explosive 1")) ;{this.list.add(e.getPlayer());e.getBlock().getWorld().createExplosion(e.getBlock().getLocation(), (float) plugin.getConfig().getDouble("explosion"));e.getPlayer().getItemInHand().setDurability((short) 0);}} @EventHandlerpublic void onExplosionDamage(EntityDamageEvent e) {if ((e.getCause() == EntityDamageEvent.DamageCause.BLOCK_EXPLOSION) &&((e.getEntity() instanceof Player))) {e.setCancelled(true);}}}
diamondcodes EntityDamage. You are checking in the EntityDamageEvent already. Since when would a block break set a player at a certain velocity?
diamondcodes first off your durability method that you are currently using will give the item full durability every time. How I would do it if it helps EntityDamageEvent If entity is a player If the cause is an explosion Player.setVelocity(new Vector());// might want to run this a tick later, not sure.
You could just fake an explosion by sending the client packets for explosions and deleting the blocks via code but it's up to you