geforkt von Mirrors/Paper
BlockDamagedEvent
By: Taylor Kelly <tkelly910@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
02b2e4114c
Commit
a0d64be250
15
paper-api/src/main/java/org/bukkit/BlockDamageLevel.java
Normale Datei
15
paper-api/src/main/java/org/bukkit/BlockDamageLevel.java
Normale Datei
@ -0,0 +1,15 @@
|
||||
package org.bukkit;
|
||||
|
||||
public enum BlockDamageLevel {
|
||||
STARTED(0), DIGGING(1), BROKEN(3), STOPPED(2);
|
||||
|
||||
private int level;
|
||||
|
||||
private BlockDamageLevel(final int level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package org.bukkit.event.block;
|
||||
|
||||
import org.bukkit.Block;
|
||||
import org.bukkit.Player;
|
||||
|
||||
/**
|
||||
* Not implemented yet
|
||||
*/
|
||||
public class BlockBrokenEvent extends BlockEvent {
|
||||
private Player player;
|
||||
|
||||
public BlockBrokenEvent(Type type, Block block ) {
|
||||
super(type, block);
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package org.bukkit.event.block;
|
||||
|
||||
import org.bukkit.Block;
|
||||
import org.bukkit.BlockDamageLevel;
|
||||
import org.bukkit.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
/**
|
||||
* @author tkelly
|
||||
*/
|
||||
public class BlockDamagedEvent extends BlockEvent implements Cancellable {
|
||||
private Player player;
|
||||
private BlockDamageLevel damageLevel;
|
||||
private boolean cancel;
|
||||
|
||||
public BlockDamagedEvent(Type type, Block block, BlockDamageLevel level, Player player) {
|
||||
super(type, block);
|
||||
this.damageLevel = level;
|
||||
this.player = player;
|
||||
this.cancel = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the player doing the damage
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the level of damage to the block
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public BlockDamageLevel getDamageLevel() {
|
||||
return damageLevel;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancel;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
}
|
@ -15,11 +15,11 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a block is broken (or destroyed)
|
||||
* Called when a block is damaged (or broken)
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onBlockBroken(BlockBrokenEvent event) {
|
||||
public void onBlockDamaged(BlockDamagedEvent event) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -132,6 +132,9 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
case BLOCK_PLACED:
|
||||
trueListener.onBlockPlaced((BlockPlacedEvent)event);
|
||||
break;
|
||||
case BLOCK_DAMAGED:
|
||||
trueListener.onBlockDamaged((BlockDamagedEvent)event);
|
||||
break;
|
||||
case BLOCK_INTERACT:
|
||||
trueListener.onBlockInteracted((BlockInteractEvent)event);
|
||||
break;
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren