forked from Slimefun/Slimefun4
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'Slimefun/master'
DEV - 1063
- Loading branch information
Showing
9 changed files
with
545 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
src/main/java/io/github/thebusybiscuit/slimefun4/api/events/SlimefunBlockBreakEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
package io.github.thebusybiscuit.slimefun4.api.events; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.ParametersAreNonnullByDefault; | ||
|
||
import org.bukkit.block.Block; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Cancellable; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.HandlerList; | ||
import org.bukkit.event.block.BlockEvent; | ||
import org.bukkit.inventory.ItemStack; | ||
|
||
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem; | ||
|
||
/** | ||
* This {@link Event} is fired whenever a {@link SlimefunItem} placed as a {@link Block} in the world is broken. | ||
* | ||
* @author J3fftw1 | ||
*/ | ||
public class SlimefunBlockBreakEvent extends Event implements Cancellable { | ||
|
||
private static final HandlerList handlers = new HandlerList(); | ||
|
||
private final Block blockBroken; | ||
private final SlimefunItem slimefunItem; | ||
private final ItemStack heldItem; | ||
private final Player player; | ||
|
||
private boolean cancelled = false; | ||
|
||
/** | ||
* @param player | ||
* The {@link Player} who broke this {@link SlimefunItem} | ||
* @param heldItem | ||
* The {@link ItemStack} held by the {@link Player} | ||
* @param blockBroken | ||
* The {@link Block} broken by the {@link Player} | ||
* @param slimefunItem | ||
* The {@link SlimefunItem} within the {@link ItemStack} | ||
*/ | ||
@ParametersAreNonnullByDefault | ||
public SlimefunBlockBreakEvent(Player player, ItemStack heldItem, Block blockBroken, SlimefunItem slimefunItem) { | ||
super(); | ||
|
||
this.player = player; | ||
this.heldItem = heldItem; | ||
this.blockBroken = blockBroken; | ||
this.slimefunItem = slimefunItem; | ||
} | ||
|
||
/** | ||
* This gets the broken {@link Block} | ||
* | ||
* @return The broken {@link Block} | ||
*/ | ||
public @Nonnull Block getBlockBroken() { | ||
return blockBroken; | ||
} | ||
|
||
/** | ||
* This gets the {@link SlimefunItem} being broken | ||
* | ||
* @return The {@link SlimefunItem} being broken | ||
*/ | ||
public @Nonnull SlimefunItem getSlimefunItem() { | ||
return slimefunItem; | ||
} | ||
|
||
/** | ||
* The {@link ItemStack} held by the {@link Player} | ||
* | ||
* @return The held {@link ItemStack} | ||
*/ | ||
public @Nonnull ItemStack getHeldItem() { | ||
return heldItem; | ||
} | ||
|
||
/** | ||
* This gets the {@link Player} | ||
* | ||
* @return The {@link Player} | ||
*/ | ||
public @Nonnull Player getPlayer() { | ||
return player; | ||
} | ||
|
||
@Override | ||
public boolean isCancelled() { | ||
return cancelled; | ||
} | ||
|
||
@Override | ||
public void setCancelled(boolean cancelled) { | ||
this.cancelled = cancelled; | ||
} | ||
|
||
public static @Nonnull HandlerList getHandlerList() { | ||
return handlers; | ||
} | ||
|
||
@Override | ||
public @Nonnull HandlerList getHandlers() { | ||
return getHandlerList(); | ||
} | ||
} |
105 changes: 105 additions & 0 deletions
105
src/main/java/io/github/thebusybiscuit/slimefun4/api/events/SlimefunBlockPlaceEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
package io.github.thebusybiscuit.slimefun4.api.events; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.ParametersAreNonnullByDefault; | ||
|
||
import org.bukkit.block.Block; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Cancellable; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.HandlerList; | ||
import org.bukkit.inventory.ItemStack; | ||
|
||
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem; | ||
|
||
/** | ||
* This {@link Event} is fired whenever a {@link SlimefunItem} is placed as a {@link Block} in the world. | ||
* | ||
* @author J3fftw1 | ||
*/ | ||
public class SlimefunBlockPlaceEvent extends Event implements Cancellable { | ||
|
||
private static final HandlerList handlers = new HandlerList(); | ||
|
||
private final Block blockPlaced; | ||
private final SlimefunItem slimefunItem; | ||
private final ItemStack placedItem; | ||
private final Player player; | ||
|
||
private boolean cancelled = false; | ||
|
||
/** | ||
* @param player | ||
* The {@link Player} who placed this {@link SlimefunItem} | ||
* @param placedItem | ||
* The {@link ItemStack} held by the {@link Player} | ||
* @param blockPlaced | ||
* The {@link Block} placed by the {@link Player} | ||
* @param slimefunItem | ||
* The {@link SlimefunItem} within the {@link ItemStack} | ||
*/ | ||
@ParametersAreNonnullByDefault | ||
public SlimefunBlockPlaceEvent(Player player, ItemStack placedItem, Block blockPlaced, SlimefunItem slimefunItem) { | ||
super(); | ||
|
||
this.player = player; | ||
this.placedItem = placedItem; | ||
this.blockPlaced = blockPlaced; | ||
this.slimefunItem = slimefunItem; | ||
} | ||
|
||
/** | ||
* This gets the placed {@link Block} | ||
* | ||
* @return The placed {@link Block} | ||
*/ | ||
public @Nonnull Block getBlockPlaced() { | ||
return blockPlaced; | ||
} | ||
|
||
/** | ||
* This gets the {@link SlimefunItem} being placed | ||
* | ||
* @return The {@link SlimefunItem} being placed | ||
*/ | ||
public @Nonnull SlimefunItem getSlimefunItem() { | ||
return slimefunItem; | ||
} | ||
|
||
/** | ||
* This gets the placed {@link ItemStack}. | ||
* | ||
* @return The placed {@link ItemStack} | ||
*/ | ||
public @Nonnull ItemStack getItemStack() { | ||
return placedItem; | ||
} | ||
|
||
/** | ||
* This gets the {@link Player} | ||
* | ||
* @return The {@link Player} | ||
*/ | ||
public @Nonnull Player getPlayer() { | ||
return player; | ||
} | ||
|
||
@Override | ||
public boolean isCancelled() { | ||
return cancelled; | ||
} | ||
|
||
@Override | ||
public void setCancelled(boolean cancelled) { | ||
this.cancelled = cancelled; | ||
} | ||
|
||
public static @Nonnull HandlerList getHandlerList() { | ||
return handlers; | ||
} | ||
|
||
@Override | ||
public @Nonnull HandlerList getHandlers() { | ||
return getHandlerList(); | ||
} | ||
} |
Oops, something went wrong.