mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-03 23:07:40 +01:00
#619: Add Player#breakBlock()
By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
parent
f034b5f0c2
commit
9777d23bd5
@ -15,8 +15,11 @@ import org.bukkit.SoundCategory;
|
|||||||
import org.bukkit.WeatherType;
|
import org.bukkit.WeatherType;
|
||||||
import org.bukkit.advancement.Advancement;
|
import org.bukkit.advancement.Advancement;
|
||||||
import org.bukkit.advancement.AdvancementProgress;
|
import org.bukkit.advancement.AdvancementProgress;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.conversations.Conversable;
|
import org.bukkit.conversations.Conversable;
|
||||||
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
|
import org.bukkit.event.block.BlockDropItemEvent;
|
||||||
import org.bukkit.event.player.PlayerResourcePackStatusEvent;
|
import org.bukkit.event.player.PlayerResourcePackStatusEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.map.MapView;
|
import org.bukkit.map.MapView;
|
||||||
@ -395,6 +398,28 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
|||||||
*/
|
*/
|
||||||
public <T> void playEffect(@NotNull Location loc, @NotNull Effect effect, @Nullable T data);
|
public <T> void playEffect(@NotNull Location loc, @NotNull Effect effect, @Nullable T data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Force this player to break a Block using the item in their main hand.
|
||||||
|
*
|
||||||
|
* This method will respect enchantments, handle item durability (if
|
||||||
|
* applicable) and drop experience and the correct items according to the
|
||||||
|
* tool/item in the player's hand.
|
||||||
|
* <p>
|
||||||
|
* Note that this method will call a {@link BlockBreakEvent}, meaning that
|
||||||
|
* this method may not be successful in breaking the block if the event was
|
||||||
|
* cancelled by a third party plugin. Care should be taken if running this
|
||||||
|
* method in a BlockBreakEvent listener as recursion may be possible if it
|
||||||
|
* is invoked on the same {@link Block} being broken in the event.
|
||||||
|
* <p>
|
||||||
|
* Additionally, a {@link BlockDropItemEvent} is called for the items
|
||||||
|
* dropped by this method (if successful).
|
||||||
|
*
|
||||||
|
* @param block the block to break
|
||||||
|
*
|
||||||
|
* @return true if the block was broken, false if the break failed
|
||||||
|
*/
|
||||||
|
public boolean breakBlock(@NotNull Block block);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a block change. This fakes a block change packet for a user at a
|
* Send a block change. This fakes a block change packet for a user at a
|
||||||
* certain location. This will not actually change the world in any way.
|
* certain location. This will not actually change the world in any way.
|
||||||
|
Loading…
Reference in New Issue
Block a user