geforkt von Mirrors/Paper
Add Player to BlockCanBuildEvent
By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
Ursprung
c6cddd3663
Commit
bba83d2264
@ -3,6 +3,7 @@ package org.bukkit.event.block;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -21,17 +22,25 @@ public class BlockCanBuildEvent extends BlockEvent {
|
|||||||
protected boolean buildable;
|
protected boolean buildable;
|
||||||
|
|
||||||
protected BlockData blockData;
|
protected BlockData blockData;
|
||||||
|
private final Player player;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public BlockCanBuildEvent(final Block block, final BlockData type, final boolean canBuild) {
|
||||||
|
this(block, null, type, canBuild);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param block the block involved in this event
|
* @param block the block involved in this event
|
||||||
|
* @param player the player placing the block
|
||||||
* @param type the id of the block to place
|
* @param type the id of the block to place
|
||||||
* @param canBuild whether we can build
|
* @param canBuild whether we can build
|
||||||
*/
|
*/
|
||||||
public BlockCanBuildEvent(final Block block, final BlockData type, final boolean canBuild) {
|
public BlockCanBuildEvent(final Block block, final Player player, final BlockData type, final boolean canBuild) {
|
||||||
super(block);
|
super(block);
|
||||||
buildable = canBuild;
|
this.player = player;
|
||||||
blockData = type;
|
this.buildable = canBuild;
|
||||||
|
this.blockData = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,6 +83,17 @@ public class BlockCanBuildEvent extends BlockEvent {
|
|||||||
return blockData;
|
return blockData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the player who placed the block involved in this event.
|
||||||
|
* <br>
|
||||||
|
* May be null for legacy calls of the event.
|
||||||
|
*
|
||||||
|
* @return The Player who placed the block involved in this event
|
||||||
|
*/
|
||||||
|
public Player getPlayer() {
|
||||||
|
return player;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HandlerList getHandlers() {
|
public HandlerList getHandlers() {
|
||||||
return handlers;
|
return handlers;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren