geforkt von Mirrors/Paper
Added SnowFormEvent. Thanks aPunch!
By: EvilSeph <evilseph@unaligned.org>
Dieser Commit ist enthalten in:
Ursprung
4baa59e20f
Commit
2fc8673c04
@ -393,6 +393,13 @@ public abstract class Event implements Serializable {
|
|||||||
*/
|
*/
|
||||||
BLOCK_BREAK (Category.BLOCK),
|
BLOCK_BREAK (Category.BLOCK),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when world attempts to place a snow block during a snowfall
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.block.SnowFormEvent
|
||||||
|
*/
|
||||||
|
SNOW_FORM (Category.BLOCK),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* INVENTORY EVENTS
|
* INVENTORY EVENTS
|
||||||
*/
|
*/
|
||||||
|
@ -108,4 +108,12 @@ public class BlockListener implements Listener {
|
|||||||
*/
|
*/
|
||||||
public void onBlockBreak(BlockBreakEvent event) {
|
public void onBlockBreak(BlockBreakEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a world is attempting to place a block during a snowfall
|
||||||
|
*
|
||||||
|
* @param event Relevant event details
|
||||||
|
*/
|
||||||
|
public void onSnowForm(SnowFormEvent event) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
76
paper-api/src/main/java/org/bukkit/event/block/SnowFormEvent.java
Normale Datei
76
paper-api/src/main/java/org/bukkit/event/block/SnowFormEvent.java
Normale Datei
@ -0,0 +1,76 @@
|
|||||||
|
package org.bukkit.event.block;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called on snow formed by weather
|
||||||
|
*/
|
||||||
|
public class SnowFormEvent extends BlockEvent implements Cancellable {
|
||||||
|
private Material material;
|
||||||
|
private byte data;
|
||||||
|
private boolean cancel;
|
||||||
|
|
||||||
|
public SnowFormEvent(Block block) {
|
||||||
|
super(Type.SNOW_FORM, block);
|
||||||
|
this.material = Material.SNOW;
|
||||||
|
this.cancel = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the material being placed on a block during snowfall
|
||||||
|
*
|
||||||
|
* @return the material being placed by a snowfall
|
||||||
|
*/
|
||||||
|
public Material getMaterial(){
|
||||||
|
return material;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the material to be placed on a block during a snowfall
|
||||||
|
*
|
||||||
|
* @param material the material to be placed during a snowfall
|
||||||
|
*/
|
||||||
|
public void setMaterial(Material material){
|
||||||
|
this.material = material;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the block data of a block involved in a snowfall
|
||||||
|
*
|
||||||
|
* @return the data of the block being placed by a snowfall
|
||||||
|
*/
|
||||||
|
public byte getData(){
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the block data of a block involved in a snowfall
|
||||||
|
*
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
public void setData(byte data){
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the cancellation state of this event. A cancelled event will not
|
||||||
|
* be executed in the server, but will still pass to other plugins
|
||||||
|
*
|
||||||
|
* @return true if this event is cancelled
|
||||||
|
*/
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the cancellation state of this event. A cancelled event will not
|
||||||
|
* be executed in the server, but will still pass to other plugins
|
||||||
|
*
|
||||||
|
* @param cancel true if you wish to cancel snow from forming during a snowfall
|
||||||
|
*/
|
||||||
|
public void setCancelled(boolean cancel) {
|
||||||
|
this.cancel = cancel;
|
||||||
|
}
|
||||||
|
}
|
@ -400,6 +400,12 @@ public final class JavaPluginLoader implements PluginLoader {
|
|||||||
((BlockListener) listener).onBlockBreak((BlockBreakEvent) event);
|
((BlockListener) listener).onBlockBreak((BlockBreakEvent) event);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
case SNOW_FORM:
|
||||||
|
return new EventExecutor() {
|
||||||
|
public void execute(Listener listener, Event event) {
|
||||||
|
((BlockListener) listener).onSnowForm((SnowFormEvent) event);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Server Events
|
// Server Events
|
||||||
case PLUGIN_ENABLE:
|
case PLUGIN_ENABLE:
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren